From f4c005990ba0e48b68da736d605a0f94c745a466 Mon Sep 17 00:00:00 2001 From: Andrew Novoselac Date: Tue, 12 Mar 2024 10:33:39 -0400 Subject: [PATCH] Basic workflow for prebuilding images --- .../workflows/build-and-publish-images.yaml | 54 +++++++++++++++++++ images/ruby/.devcontainer/Dockerfile | 5 ++ images/ruby/.devcontainer/devcontainer.json | 24 +++++++++ 3 files changed, 83 insertions(+) create mode 100644 .github/workflows/build-and-publish-images.yaml create mode 100644 images/ruby/.devcontainer/Dockerfile create mode 100644 images/ruby/.devcontainer/devcontainer.json diff --git a/.github/workflows/build-and-publish-images.yaml b/.github/workflows/build-and-publish-images.yaml new file mode 100644 index 0000000..53c108f --- /dev/null +++ b/.github/workflows/build-and-publish-images.yaml @@ -0,0 +1,54 @@ +name: Build and Publish Images + +on: + workflow_dispatch: + +jobs: + build: + name: Build Images + + strategy: + fail-fast: false + matrix: + RUBY_VERSION: + - 3.3.0 + - 3.2.2 + - 3.2.1 + - 3.2.0 + - 3.1.4 + - 3.1.3 + - 3.1.2 + - 3.1.1 + - 3.1.0 + - 3.0.6 + - 3.0.5 + - 3.0.4 + - 3.0.3 + - 3.0.2 + - 3.0.1 + - 3.0.0 + + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - name: Checkout (GitHub) + uses: actions/checkout@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Pre-build Dev Container Image + uses: devcontainers/ci@v0.3 + env: + RUBY_VERSION: ${{ matrix.RUBY_VERSION }} + with: + imageName: ghcr.io/rails/devcontainer/images/ruby + cacheFrom: ghcr.io/rails/devcontainer/images/ruby + imageTag: 0.1.0-${{ matrix.RUBY_VERSION }} + subFolder: images/ruby + push: always \ No newline at end of file diff --git a/images/ruby/.devcontainer/Dockerfile b/images/ruby/.devcontainer/Dockerfile new file mode 100644 index 0000000..f3d0f79 --- /dev/null +++ b/images/ruby/.devcontainer/Dockerfile @@ -0,0 +1,5 @@ +FROM mcr.microsoft.com/devcontainers/base:1-bookworm + +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + # Remove imagemagick due to https://security-tracker.debian.org/tracker/CVE-2019-10131 + && apt-get purge -y imagemagick imagemagick-6-common \ No newline at end of file diff --git a/images/ruby/.devcontainer/devcontainer.json b/images/ruby/.devcontainer/devcontainer.json new file mode 100644 index 0000000..18f2cf0 --- /dev/null +++ b/images/ruby/.devcontainer/devcontainer.json @@ -0,0 +1,24 @@ +{ + "build": { + "dockerfile": "./Dockerfile", + "context": "." + }, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "true", + "username": "vscode", + "userUid": "1000", + "userGid": "1000", + "upgradePackages": "true" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": "false" + }, + "ghcr.io/rails/devcontainer/features/ruby:0.1.0": { + "version": "${localEnv:RUBY_VERSION}" + } + }, + // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} \ No newline at end of file