Skip to content

Commit e7dbaf6

Browse files
committed
feat/ci/cache-docker-layers
1 parent 249e042 commit e7dbaf6

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
poetry run python tasks/format.py --dry-run
107107
108108
test:
109-
timeout-minutes: 3
109+
timeout-minutes: 6
110110
runs-on: ubuntu-latest
111111
needs: [look_for_source_code_changes, lint]
112112
if: needs.look_for_source_code_changes.outputs.run_tests == 'true'
@@ -115,6 +115,18 @@ jobs:
115115
- name: Checkout repository
116116
uses: actions/checkout@v6
117117

118+
- name: Set up Docker Buildx
119+
uses: docker/setup-buildx-action@v4
120+
121+
- name: Build API image with cache
122+
uses: docker/build-push-action@v7
123+
with:
124+
context: .
125+
load: true
126+
tags: flask_api:ci
127+
cache-from: type=gha
128+
cache-to: type=gha,mode=max
129+
118130
- name: Start Docker Compose
119131
run: docker compose up -d
120132

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ FROM python:3.14.3-trixie AS python
33

44
FROM python AS python_with_libreoffice
55

6-
RUN apt-get update && \
6+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
7+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
8+
apt-get update && \
79
apt-get --no-install-recommends install libreoffice -y && \
810
apt-get install -y libreoffice-java-common default-jre
911

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
services:
22
api:
3+
image: flask_api:ci
34
container_name: "flask_api"
45
environment:
56
POETRY_VIRTUALENVS_CREATE: "false"

0 commit comments

Comments
 (0)