Skip to content

Commit

Permalink
Merge pull request #5 from macbre/cache-docker-pull
Browse files Browse the repository at this point in the history
docker pull to use the cache when building
  • Loading branch information
macbre authored Jul 7, 2021
2 parents e8553f9 + 267579e commit 3232874
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# This file is used by CI pipeline when testing this action
FROM alpine:latest

RUN apk update \
&& apk -a info curl \
&& apk add curl

# these two are passed as build args and stored as env variables
ARG BUILD_DATE
ARG GITHUB_SHA
Expand Down
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,20 @@ runs:
# expand commands
set -x
docker -v
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo
echo "Building the Docker image: ${{ inputs.repository }}/${{ inputs.image_name }}:${{ env.COMMIT_TAG }} ..."
echo
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 \
# https://docs.docker.com/develop/develop-images/build_enhancements/
# https://docs.docker.com/engine/reference/commandline/build/#specifying-external-cache-sources
DOCKER_BUILDKIT=1 \
docker build . \
--cache-from ${{ inputs.repository }}/${{ inputs.image_name }}:latest \
--build-arg BUILDKIT_INLINE_CACHE=1 \
\
--build-arg BUILD_DATE=${BUILD_DATE} \
--build-arg GITHUB_SHA=${GITHUB_SHA} \
Expand Down

0 comments on commit 3232874

Please sign in to comment.