Skip to content

Commit da364d5

Browse files
author
Jean-Louis Fuchs
committed
use buildx/inline cache
1 parent a45c18c commit da364d5

File tree

7 files changed

+130
-68
lines changed

7 files changed

+130
-68
lines changed

.github/workflows/main.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
schedule:
8+
- cron: "0 0 * * 0"
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Login to GitHub Container Registry
19+
uses: docker/login-action@v3
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
with:
28+
buildkitd-flags: --debug
29+
30+
- name: Build container
31+
uses: docker/build-push-action@v5
32+
with:
33+
context: compose
34+
push: false
35+
load: true
36+
tags: ghcr.io/adfinis/pyaptly/cache:latest
37+
cache-from: type=gha
38+
cache-to: type=gha,mode=max
39+
build-args: BUILDKIT_INLINE_CACHE=1
40+
41+
- name: Push incline cache
42+
run: |
43+
docker images
44+
docker push ghcr.io/adfinis/pyaptly/cache:latest

.github/workflows/pull-request.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Login to GitHub Container Registry
17+
uses: docker/login-action@v3
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.actor }}
21+
password: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
with:
26+
buildkitd-flags: --debug
27+
28+
- name: Build container
29+
uses: docker/build-push-action@v5
30+
with:
31+
context: compose
32+
push: false
33+
tags: ghcr.io/adfinis/pyaptly/cache:latest
34+
cache-from: type=gha
35+
cache-to: |
36+
type=gha,mode=max
37+
type=inline

.github/workflows/testing.yml

-27
This file was deleted.

Makefile

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
.DEFAULT_GOAL := help
22

3+
CACHE_IMG = "ghcr.io/adfinis/pyaptly/cache:latest"
4+
5+
DOCKER_BUILDKIT = 1
6+
export DOCKER_BUILDKIT
7+
38
# Help target extracts the double-hash comments from the targets and shows them
49
# in a convenient way. This allows us to easily document the user-facing Make
510
# targets
611
.PHONY: help
712
help:
813
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort -k 1,1 | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
914

15+
.PHONY: pull
16+
pull: ## pull docker build cache from registry
17+
@docker pull $(CACHE_IMG)
18+
1019
.PHONY: up
11-
up: ## start and build container if needed
12-
#@docker pull ghcr.io/adfinis/pyaptly/cache:latest
13-
@DOCKER_BUILDKIT=1 docker compose up -d --build
20+
up: ## start the container (cached)
21+
@docker compose up -d --build
1422

1523
.PHONY: push
1624
push: ## push docker build cache to registry
17-
@docker push ghcr.io/adfinis/pyaptly/cache:latest
25+
@docker push $(CACHE_IMG)
1826

1927
.PHONY: down
2028
down: ## stop and remove container

compose/Dockerfile

+35-33
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
1-
ARG DOCKER_IMAGE
2-
FROM $DOCKER_IMAGE
1+
FROM debian:bookworm-slim
32

4-
RUN apt-get update && apt-get install -y --no-install-recommends \
5-
python3-toml \
6-
python3-requests \
7-
python3-poetry \
8-
gnupg \
9-
bzip2 \
10-
tini \
11-
curl \
12-
wait-for-it \
13-
entr \
14-
gnutls-bin \
15-
nettle-dev \
16-
gcc \
17-
llvm-dev \
18-
libclang-dev \
19-
build-essential \
20-
pkg-config \
21-
gettext \
22-
git \
23-
procps \
24-
psmisc \
25-
vim-tiny \
26-
cargo \
27-
&& rm -rf /var/lib/apt/lists/* \
28-
&& apt-get clean \
29-
&& apt-get autoclean \
30-
&& rm -rf /var/lib/apt/archives/* \
31-
&& rm -rf /var/cache/apt/*
3+
#RUN apt-get update && apt-get install -y --no-install-recommends \
4+
# python3-toml \
5+
# python3-requests \
6+
# python3-poetry \
7+
# gnupg \
8+
# bzip2 \
9+
# tini \
10+
# curl \
11+
# wait-for-it \
12+
# entr \
13+
# gnutls-bin \
14+
# nettle-dev \
15+
# gcc \
16+
# llvm-dev \
17+
# libclang-dev \
18+
# build-essential \
19+
# pkg-config \
20+
# gettext \
21+
# git \
22+
# procps \
23+
# psmisc \
24+
# vim-tiny \
25+
# cargo \
26+
# && rm -rf /var/lib/apt/lists/* \
27+
# && apt-get clean \
28+
# && apt-get autoclean \
29+
# && rm -rf /var/lib/apt/archives/* \
30+
# && rm -rf /var/cache/apt/*
3231
ADD setup /setup
33-
RUN /setup/setup
34-
ADD run /setup/run
35-
ENTRYPOINT ["/usr/bin/tini", "--"]
32+
RUN echo build build build build
33+
# RUN /setup/setup
34+
# ADD run /setup/run
35+
WORKDIR /source
36+
ENTRYPOINT ["/usr/bin/tini", "--"]
37+
CMD ["bash", "/setup/run"]

compose/setup/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2

docker-compose.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ services:
44
image: ghcr.io/adfinis/pyaptly/cache:latest
55
build:
66
cache_from:
7-
- ghcr.io/adfinis/pyaptly/cache:latest
7+
- type=registry,ref=ghcr.io/adfinis/pyaptly/cache:latest
88
context: compose
99
args:
1010
BUILDKIT_INLINE_CACHE: 1
11-
DOCKER_IMAGE: debian:bookworm-slim
12-
working_dir: /source
13-
command: ["bash", "/setup/run"]
1411
volumes:
1512
- ./:/source

0 commit comments

Comments
 (0)