From 7e1bb7395ea26d16a302c6089423394380fd981b Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 23 May 2024 17:10:20 +0100 Subject: [PATCH] Fix Docker issues - Copy `.ruby-version` file to Docker build context - always run `docker build` in CI, even when not deploying --- .dockerignore | 6 +++++- .github/workflows/main.yml | 3 +++ Dockerfile | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index 0fd8fbd..5e64996 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,7 @@ -**/.* +.dockerignore +.editorconfig +.github/ +.gitignore +.rubocop.yml deployment/ state.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1f40dff..ff08ffc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,6 +29,9 @@ jobs: - name: Run RuboCop run: bundle exec rubocop + - name: Build Docker image + run: docker build --build-arg RUBY_VERSION=$(cat .ruby-version) . + deploy: needs: checks if: github.repository_owner == 'Homebrew' && github.event_name == 'push' diff --git a/Dockerfile b/Dockerfile index b7e7698..4bdc7cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ FROM ruby:$RUBY_VERSION-alpine RUN apk add --no-cache --virtual .build-deps git build-base WORKDIR /app -COPY Gemfile* ./ +COPY .ruby-version Gemfile* ./ ENV BUNDLE_DEPLOYMENT=1 RUN bundle install && apk del --no-cache .build-deps