Skip to content

CI/CD: Cache server Docker image to speed up time for setting up server #743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: dev
Choose a base branch
from
Draft
10 changes: 6 additions & 4 deletions .github/actions/run-ee-server/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ runs:
shell: bash

# macOS Github runners and Windows self-hosted runners don't have buildx installed by default
- if: ${{ runner.os == 'Windows' || runner.os == 'macOS' }}
uses: docker/setup-buildx-action@v3
# Also we want to use the docker-container driver so we can cache our custom server image
- uses: docker/setup-buildx-action@v3

- run: echo CA_CERT_FILE_NAME="ca.cer" >> $GITHUB_ENV
shell: bash
Expand All @@ -62,10 +62,12 @@ runs:
SERVER_IMAGE=${{ env.IMAGE_NAME }}
TLS_PORT=${{ env.TLS_PORT }}
tags: ${{ env.NEW_IMAGE_NAME }}
# setup-buildx-action configures Docker to use the docker-container build driver
# This driver doesn't publish an image locally by default
# the docker-container driver doesn't publish an image locally by default
# so we have to manually enable it
load: true
# Also cache so we don't have to rebuild every time we use this action
cache-from: type=gha
cache-to: type=gha,mode=max

- run: echo SERVER_CONTAINER_NAME="aerospike" >> $GITHUB_ENV
shell: bash
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docker-build-context/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ EXPOSE $TLS_PORT
FROM ubuntu:24.04 AS dos2unix

# Run our own set up steps after server finishes starting up
# Running WORKDIR on an existing directory causes WORKDIR instruction to not be cached
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad comment

RUN mkdir /my-scripts
WORKDIR /my-scripts
COPY entrypoint-finalize-setup.bash wait-for-as-server-to-start.bash .
# Both Github Actions and the entrypoint script can reuse this wait script
Expand Down
Loading