diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..dfefeb9 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,14 @@ +name: Docker build + +on: [push] + +jobs: + docker-build: + runs-on: ubuntu-24.04 + env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + steps: + - uses: actions/checkout@v4 + - name: Build Docker image + run: docker build -t "${REGISTRY}/${IMAGE_NAME}" . diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..8183796 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,24 @@ +name: Docker Publish + +on: + push: + branches: ["main"] + +jobs: + docker-build: + runs-on: ubuntu-24.04 + env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + steps: + - uses: actions/checkout@v4 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build Docker image + run: docker build -t "${REGISTRY}/${IMAGE_NAME}:main" . + - name: Push Docker image + run: docker push "${REGISTRY}/${IMAGE_NAME}:main" diff --git a/Dockerfile b/Dockerfile index 2ca87f2..a363a01 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile ARG RUBY_VERSION=3.3.6 -FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base +FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim AS base # Rails app lives here WORKDIR /rails @@ -14,7 +14,7 @@ ENV RAILS_ENV="production" \ BUNDLE_WITHOUT="development" # Throw-away build stage to reduce size of final image -FROM base as build +FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ diff --git a/Gemfile.lock b/Gemfile.lock index 9eb060d..b3dd0b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -475,7 +475,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 3.3.4p94 + ruby 3.3.6p108 BUNDLED WITH 2.5.14