Skip to content

chore: use bind mount for buildcache instead of copy step #439

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

Merged
merged 11 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/dockerhub-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
outputs:
image_digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v3

- id: meta
uses: docker/metadata-action@v4
with:
Expand All @@ -41,7 +43,6 @@ jobs:
run: |
docker context create builders


- uses: docker/setup-buildx-action@v2
with:
endpoint: builders
Expand All @@ -51,6 +52,14 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- id: copy-cache
name: Copy Buildcache
run: |
docker rm -f buildcache
docker create --name buildcache public.ecr.aws/t3w2s2c9/postgres-buildcache:latest ls
docker cp buildcache:/ccache/. ./docker/cache
docker rm -f buildcache

- id: build
uses: docker/build-push-action@v3
with:
Expand Down Expand Up @@ -84,6 +93,14 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- id: copy-cache
name: Copy Buildcache
run: |
docker rm -f buildcache
docker create --name buildcache public.ecr.aws/t3w2s2c9/postgres-buildcache:latest ls
docker cp buildcache:/ccache/. ./docker/cache/
docker rm -f buildcache

- uses: docker/setup-buildx-action@v2
with:
driver: docker
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.python-version
venv/
*.swp
docker/cache/
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ RUN apt update && \
apt install -y ansible sudo git ccache && \
apt -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

COPY --from=public.ecr.aws/t3w2s2c9/postgres-buildcache:latest /ccache/ /ccache/

RUN ccache -s && \
RUN --mount=type=bind,source=docker/cache,target=/ccache,rw \
ccache -s && \
cd /tmp/ansible && \
ansible-playbook -e '{"async_mode": false}' playbook-docker.yml && \
apt -y autoremove && \
Expand All @@ -25,7 +24,7 @@ RUN ccache -s && \
apt install -y default-jdk-headless locales && \
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen && \
rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* /ccache
rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*

ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
Expand Down
Empty file added docker/cache/.gitkeep
Empty file.