-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #803 from dxw/chore/docker-cache-github-action
Improved caching with Docker in CI
- Loading branch information
Showing
5 changed files
with
99 additions
and
38 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
.github/actions/continuous-integration/load-cache/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Build and cache image | ||
runs: | ||
using: "composite" | ||
steps: | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Build and cache image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
build-args: | | ||
RAILS_ENV=test | ||
push: false | ||
load: true | ||
tags: app_test:latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=min |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# ------------------------------------------------------------------------------ | ||
# Base | ||
# ------------------------------------------------------------------------------ | ||
FROM ruby:3.3.6 as base | ||
FROM ruby:3.3.6 AS base | ||
LABEL org.opencontainers.image.authors="[email protected]" | ||
|
||
COPY .node-version .node-version | ||
|
@@ -17,12 +17,12 @@ RUN \ | |
build-essential \ | ||
libpq-dev | ||
|
||
ENV APP_HOME /srv/app | ||
ENV DEPS_HOME /deps | ||
ENV APP_HOME=/srv/app | ||
ENV DEPS_HOME=/deps | ||
|
||
ARG RAILS_ENV | ||
ENV RAILS_ENV ${RAILS_ENV:-production} | ||
ENV NODE_ENV ${RAILS_ENV:-production} | ||
ENV RAILS_ENV=${RAILS_ENV:-production} | ||
ENV NODE_ENV=${RAILS_ENV:-production} | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Dependencies | ||
|
@@ -34,7 +34,7 @@ RUN apt-get update && apt-get install -y yarn | |
WORKDIR ${DEPS_HOME} | ||
|
||
# Install Ruby dependencies | ||
ENV BUNDLE_GEM_GROUPS ${RAILS_ENV} | ||
ENV BUNDLE_GEM_GROUPS=${RAILS_ENV} | ||
|
||
COPY Gemfile ${DEPS_HOME}/Gemfile | ||
COPY Gemfile.lock ${DEPS_HOME}/Gemfile.lock | ||
|
@@ -109,8 +109,8 @@ RUN \ | |
ARG CURRENT_GIT_SHA | ||
ARG TIME_OF_BUILD | ||
|
||
ENV CURRENT_GIT_SHA ${CURRENT_GIT_SHA} | ||
ENV TIME_OF_BUILD ${TIME_OF_BUILD} | ||
ENV CURRENT_GIT_SHA=${CURRENT_GIT_SHA} | ||
ENV TIME_OF_BUILD=${TIME_OF_BUILD} | ||
|
||
COPY ./docker-entrypoint.sh / | ||
RUN chmod +x /docker-entrypoint.sh | ||
|
@@ -123,7 +123,7 @@ CMD ["bundle", "exec", "rails", "server"] | |
# ------------------------------------------------------------------------------ | ||
# Test | ||
# ------------------------------------------------------------------------------ | ||
FROM web as test | ||
FROM web AS test | ||
|
||
RUN \ | ||
apt-get update && \ | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.