diff --git a/.github/workflows/build-and-push.yaml b/.github/workflows/build-and-push.yaml index de812c2..e69de29 100644 --- a/.github/workflows/build-and-push.yaml +++ b/.github/workflows/build-and-push.yaml @@ -1,111 +0,0 @@ -name: Build and Push DevContainer Images - -on: - pull_request: - branches: - - main - types: - - opened - - reopened - - synchronize - paths: - - "./dockerfiles/**" - workflow_dispatch: - -jobs: - detect-changes: - name: Detect Changed Images - runs-on: ubuntu-24.04 - outputs: - node: ${{ steps.changes.outputs.node }} - php+node: ${{ steps.changes.outputs.php-node }} - python: ${{ steps.changes.outputs.python }} - ubuntu: ${{ steps.changes.outputs.ubuntu }} - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Detect changes - id: changes - uses: dorny/paths-filter@v3 - with: - filters: | - 'node': - - 'dockerfiles/node/Dockerfile' - 'php-node': - - 'dockerfiles/php-node/Dockerfile' - 'python': - - 'dockerfiles/python/Dockerfile' - 'ubuntu': - - 'dockerfiles/ubuntu/Dockerfile' - - build-and-push: - name: Build ${{ matrix.image }} - needs: detect-changes - if: | - needs.detect-changes.outputs.node == 'true' || - needs.detect-changes.outputs.php-node == 'true' || - needs.detect-changes.outputs.python == 'true' || - needs.detect-changes.outputs.ubuntu == 'true' - runs-on: ubuntu-24.04 - strategy: - fail-fast: false - matrix: - include: - - image: node - changed: ${{ needs.detect-changes.outputs.node }} - - image: php+node - changed: ${{ needs.detect-changes.outputs.php-node }} - - image: python - changed: ${{ needs.detect-changes.outputs.python }} - - image: ubuntu - changed: ${{ needs.detect-changes.outputs.ubuntu }} - steps: - - name: Skip if not changed - if: matrix.changed != 'true' - run: | - echo "Skipping ${{ matrix.image }} - no changes detected" - exit 0 - - - name: Checkout Repository - if: matrix.changed == 'true' - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - if: matrix.changed == 'true' - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - if: matrix.changed == 'true' - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - if: matrix.changed == 'true' - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/devcontainer-${{ matrix.image }} - tags: | - type=raw,value=latest - type=sha,prefix={{branch}}- - type=ref,event=branch - type=semver,pattern={{version}} - - - name: Build and push - if: matrix.changed == 'true' - uses: docker/build-push-action@v5 - with: - context: ./dockerfiles/${{ matrix.image }} - file: ./dockerfiles/${{ matrix.image }}/Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - platforms: linux/amd64,linux/arm64 diff --git a/dockerfiles/node/Dockerfile b/dockerfiles/node/Dockerfile index 641b166..2b01208 100644 --- a/dockerfiles/node/Dockerfile +++ b/dockerfiles/node/Dockerfile @@ -1,11 +1,11 @@ -FROM appzic/dc:base-ubuntu-22.04 +ARG BASE_IMAGE +FROM ${BASE_IMAGE} -ARG VERSION=20.x +ARG NODE_VERSION USER vscode RUN sudo apt-get update -y -# Install Node 20.x -RUN curl -fsSL https://deb.nodesource.com/setup_${VERSION} | sudo -E bash - &&\ +RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | sudo -E bash - &&\ sudo apt-get install -y nodejs \ No newline at end of file diff --git a/dockerfiles/node/values.yaml b/dockerfiles/node/values.yaml new file mode 100644 index 0000000..7942890 --- /dev/null +++ b/dockerfiles/node/values.yaml @@ -0,0 +1,19 @@ +image: + name: ghcr.io/appzic/devcontainer-node + tags: + - tag: 18.x + args: + - base_image: ghcr.io/appzic/devcontainer-ubuntu:24.04 + - node_version: 18.x + - tag: 20.x + args: + - base_image: ghcr.io/appzic/devcontainer-ubuntu:24.04 + - node_version: 20.x + - tag: 22.x + args: + - base_image: ghcr.io/appzic/devcontainer-ubuntu:24.04 + - node_version: 22.x + - tag: 24.x + args: + - base_image: ghcr.io/appzic/devcontainer-ubuntu:24.04 + - node_version: 24.x diff --git a/dockerfiles/php-node/Dockerfile b/dockerfiles/php-node/Dockerfile index f7645d6..f084f6c 100644 --- a/dockerfiles/php-node/Dockerfile +++ b/dockerfiles/php-node/Dockerfile @@ -1,21 +1,15 @@ -FROM appzic/dc:base-ubuntu-22.04 +ARG BASE_IMAGE +FROM ${BASE_IMAGE} -ARG VERSION=8.1 -ARG NODE_VERSION=18.x +ARG PHP_VERSION USER vscode -RUN sudo apt-get update -y - -# Install Node Js -RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | sudo -E bash - &&\ - sudo apt-get install -y nodejs - # Install php RUN sudo add-apt-repository ppa:ondrej/php \ && sudo apt-get update -y \ - && sudo apt-get install -y php${VERSION} \ - && sudo a2enmod php${VERSION} + && sudo apt-get install -y php${PHP_VERSION} \ + && sudo a2enmod php${PHP_VERSION} # Install composer RUN curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php \ @@ -23,13 +17,13 @@ RUN curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php \ # Install php modules RUN sudo apt-get install -y \ - php${VERSION}-cli \ - php${VERSION}-common \ - php${VERSION}-mysql \ - php${VERSION}-zip \ - php${VERSION}-gd \ - php${VERSION}-mbstring \ - php${VERSION}-curl \ - php${VERSION}-xml \ - php${VERSION}-bcmath \ - php${VERSION}-sqlite3 + php${PHP_VERSION}-cli \ + php${PHP_VERSION}-common \ + php${PHP_VERSION}-mysql \ + php${PHP_VERSION}-zip \ + php${PHP_VERSION}-gd \ + php${PHP_VERSION}-mbstring \ + php${PHP_VERSION}-curl \ + php${PHP_VERSION}-xml \ + php${PHP_VERSION}-bcmath \ + php${PHP_VERSION}-sqlite3 diff --git a/dockerfiles/php-node/values.yaml b/dockerfiles/php-node/values.yaml new file mode 100644 index 0000000..b7415df --- /dev/null +++ b/dockerfiles/php-node/values.yaml @@ -0,0 +1,11 @@ +image: + name: ghcr.io/appzic/devcontainer-php-node + tags: + - tag: php8.1-node20.x + args: + - base_image: ghcr.io/appzic/devcontainer-node:20.x + - php_version: 8.1 + - tag: php8.3-node24.x + args: + - base_image: ghcr.io/appzic/devcontainer-node:24.x + - php_version: 8.3 diff --git a/dockerfiles/python/Dockerfile b/dockerfiles/python/Dockerfile index fbf6461..bcfab7c 100644 --- a/dockerfiles/python/Dockerfile +++ b/dockerfiles/python/Dockerfile @@ -1,21 +1,22 @@ -FROM appzic/dc:base-ubuntu-22.04 +ARG BASE_IMAGE +FROM ${BASE_IMAGE} -ARG VERSION=3.7.3 +ARG PYTHON_VERSION USER vscode # Download extract and python source file RUN cd /tmp && \ - wget https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz && \ - sudo tar -xf ./Python-${VERSION}.tgz + wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz && \ + sudo tar -xf ./Python-${PYTHON_VERSION}.tgz # Install -RUN cd /tmp/Python-${VERSION} &&\ +RUN cd /tmp/Python-${PYTHON_VERSION} &&\ sudo ./configure --enable-optimizations &&\ sudo make install # Remove .tgz file -RUN sudo rm -fr /tmp/Python-${VERSION}.tgz +RUN sudo rm -fr /tmp/Python-${PYTHON_VERSION}.tgz # Install python packages RUN sudo pip3 install pipenv diff --git a/dockerfiles/python/values.yaml b/dockerfiles/python/values.yaml new file mode 100644 index 0000000..1da86ff --- /dev/null +++ b/dockerfiles/python/values.yaml @@ -0,0 +1,15 @@ +image: + name: ghcr.io/appzic/devcontainer-python + tags: + - tag: 3.7.3 + args: + - base_image: ghcr.io/appzic/devcontainer-ubuntu:24.04 + - python_version: 3.7.3 + - tag: 3.12.2 + args: + - base_image: ghcr.io/appzic/devcontainer-ubuntu:24.04 + - python_version: 3.12.2 + - tag: 3.14.0 + args: + - base_image: ghcr.io/appzic/devcontainer-ubuntu:24.04 + - python_version: 3.14.0 diff --git a/dockerfiles/ubuntu/Dockerfile b/dockerfiles/ubuntu/Dockerfile index fdd80b5..41cfbbe 100644 --- a/dockerfiles/ubuntu/Dockerfile +++ b/dockerfiles/ubuntu/Dockerfile @@ -1,5 +1,4 @@ ARG UBUNTU_VERSION - FROM mcr.microsoft.com/devcontainers/base:ubuntu-${UBUNTU_VERSION} USER vscode