Skip to content

Commit ec40b93

Browse files
committed
docker/kea: kea 2.3
1 parent e075de3 commit ec40b93

File tree

3 files changed

+68
-119
lines changed

3 files changed

+68
-119
lines changed

.github/workflows/docker-kea.jsonnet

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1 @@
1-
{
2-
name: 'docker-kea',
3-
on: {
4-
push: {
5-
branches: ['master', 'test'],
6-
paths: ['docker/kea/**'],
7-
},
8-
},
9-
jobs: {
10-
build: {
11-
name: 'build',
12-
'runs-on': 'ubuntu-latest',
13-
permissions: { 'id-token': 'write', contents: 'read' },
14-
steps: [
15-
{ uses: 'actions/checkout@v3' },
16-
{
17-
name: 'setup docker multiarch',
18-
run: |||
19-
mkdir -p ~/.docker
20-
sudo docker run --rm --privileged multiarch/qemu-user-static --reset --persistent yes --credential yes
21-
|||,
22-
},
23-
24-
25-
{
26-
uses: 'actions-rs/toolchain@v1',
27-
with: {
28-
profile: 'minimal',
29-
toolchain: 'stable',
30-
target: 'aarch64-unknown-linux-gnu',
31-
},
32-
},
33-
{
34-
uses: 'actions-rs/cargo@v1',
35-
with: {
36-
'use-cross': true,
37-
command: 'build',
38-
args: '--release --locked --manifest-path docker/kea/healthz/Cargo.toml --target aarch64-unknown-linux-gnu',
39-
},
40-
},
41-
42-
43-
{
44-
uses: 'docker/setup-buildx-action@v2',
45-
with: { install: true },
46-
},
47-
{
48-
uses: 'aws-actions/configure-aws-credentials@v1',
49-
with: {
50-
'aws-region': 'ap-northeast-1',
51-
'role-to-assume': 'arn:aws:iam::005216166247:role/GhaDockerPush',
52-
'role-skip-session-tagging': true,
53-
},
54-
},
55-
{
56-
uses: 'aws-actions/amazon-ecr-login@v1',
57-
id: 'login-ecr',
58-
},
59-
{
60-
uses: 'docker/build-push-action@v3',
61-
with: {
62-
context: 'docker/kea',
63-
platforms: std.join(',', ['linux/arm64']),
64-
tags: std.join(',', [
65-
'${{ steps.login-ecr.outputs.registry }}/kea:${{ github.sha }}',
66-
'${{ steps.login-ecr.outputs.registry }}/kea:latest',
67-
]),
68-
push: true,
69-
},
70-
},
71-
],
72-
},
73-
},
74-
}
1+
(import './docker-build-simple.libsonnet')('kea')

.github/workflows/docker-kea.yml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,10 @@
99
"runs-on": "ubuntu-latest",
1010
"steps": [
1111
{
12-
"uses": "actions/checkout@v3"
12+
"uses": "docker/setup-qemu-action@v2"
1313
},
1414
{
15-
"name": "setup docker multiarch",
16-
"run": "mkdir -p ~/.docker\nsudo docker run --rm --privileged multiarch/qemu-user-static --reset --persistent yes --credential yes\n"
17-
},
18-
{
19-
"uses": "actions-rs/toolchain@v1",
20-
"with": {
21-
"profile": "minimal",
22-
"target": "aarch64-unknown-linux-gnu",
23-
"toolchain": "stable"
24-
}
25-
},
26-
{
27-
"uses": "actions-rs/cargo@v1",
28-
"with": {
29-
"args": "--release --locked --manifest-path docker/kea/healthz/Cargo.toml --target aarch64-unknown-linux-gnu",
30-
"command": "build",
31-
"use-cross": true
32-
}
33-
},
34-
{
35-
"uses": "docker/setup-buildx-action@v2",
36-
"with": {
37-
"install": true
38-
}
15+
"uses": "docker/setup-buildx-action@v2"
3916
},
4017
{
4118
"uses": "aws-actions/configure-aws-credentials@v1",
@@ -52,7 +29,7 @@
5229
{
5330
"uses": "docker/build-push-action@v3",
5431
"with": {
55-
"context": "docker/kea",
32+
"context": "{{defaultContext}}:docker/kea",
5633
"platforms": "linux/arm64",
5734
"push": true,
5835
"tags": "${{ steps.login-ecr.outputs.registry }}/kea:${{ github.sha }},${{ steps.login-ecr.outputs.registry }}/kea:latest"
@@ -69,7 +46,8 @@
6946
"test"
7047
],
7148
"paths": [
72-
"docker/kea/**"
49+
"docker/kea/**",
50+
".github/workflows/docker-kea.yml"
7351
]
7452
}
7553
}

kea/Dockerfile

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,82 @@
1-
FROM public.ecr.aws/ubuntu/ubuntu:22.04 as config
2-
RUN apt-get update && apt-get install -y jsonnet
1+
# syntax=docker/dockerfile:1
2+
3+
ARG BASE=public.ecr.aws/ubuntu/ubuntu:22.04
4+
5+
# `~` is mangled as `.`
6+
ARG KEA_VERSION=2.3.6-1.rk1.jammy
7+
8+
###
9+
10+
FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/rust:1.69-slim-bullseye as build
11+
RUN rustup target add aarch64-unknown-linux-gnu
12+
RUN apt-get update \
13+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
14+
gcc-aarch64-linux-gnu
15+
16+
WORKDIR /build/healthz
17+
COPY healthz/ ./
18+
19+
RUN --mount=type=cache,target=/usr/local/cargo/registry \
20+
--mount=type=cache,target=/build/healthz/target \
21+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
22+
cargo install --path . --root /app --locked --target=aarch64-unknown-linux-gnu
23+
24+
###
25+
26+
FROM --platform=$BUILDPLATFORM $BASE as config
27+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y jsonnet
328
WORKDIR /app
429
COPY kea-ctrl-agent.jsonnet /tmp/
530
RUN jsonnet /tmp/kea-ctrl-agent.jsonnet > /app/kea-ctrl-agent.json
631

7-
FROM public.ecr.aws/ubuntu/ubuntu:22.04
32+
###
33+
34+
FROM --platform=$BUILDPLATFORM $BASE as download
35+
36+
RUN apt-get update \
37+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
38+
curl \
39+
ca-certificates
40+
41+
ARG KEA_VERSION
42+
43+
WORKDIR /download
44+
RUN curl -SsfL --remote-name-all \
45+
https://github.com/hanazuki/isc-kea.deb/releases/download/debian%2F2.3.6-1_rk1_jammy/{kea-admin_${KEA_VERSION}_arm64.deb,kea-common_${KEA_VERSION}_arm64.deb,kea-ctrl-agent_${KEA_VERSION}_arm64.deb,kea-dhcp4-server_${KEA_VERSION}_arm64.deb} \
46+
https://sorah-pkg.s3.dualstack.ap-northeast-1.amazonaws.com/misc/isc-stork-agent_1.5.0.220824140136_arm64.deb
47+
48+
RUN sha384sum -c --strict <<EOF
49+
3da15d37c3edbaf670400c4221a7d116ebc306c4c573d3f3a6b8ace2ec1fb3782194b118c37a803b6696aa0340f45b17 kea-admin_2.3.6-1.rk1.jammy_arm64.deb
50+
8d4fadc507ce3a98199dceefd71f2da689cab40aa97753bdfb0f2facff0f5c734b968d86809c666dea5f01ec35eb04ac kea-common_2.3.6-1.rk1.jammy_arm64.deb
51+
a735a6e6102defd5fadb20900fb92bbd769368c5c211be3f0f0e9ccab29d2d6e69ad65dd46fed22a016ed0b5a2e74c90 kea-ctrl-agent_2.3.6-1.rk1.jammy_arm64.deb
52+
525e1ba2c96929ce32385d4c240a43ce7c4daf96023810d167b9204ba680517e8557896d40ab1d387de996fce7a84e68 kea-dhcp4-server_2.3.6-1.rk1.jammy_arm64.deb
53+
1e8b67f2afe4404ea3091cbef14e93a23186633a3d571f9cb141d162350d2fe6235d7679e89bed5c2235433f203d706d isc-stork-agent_1.5.0.220824140136_arm64.deb
54+
EOF
55+
56+
###
57+
58+
FROM $BASE
859

960
RUN mkdir -p /run/kea /app
1061
VOLUME /run/kea
1162

12-
RUN apt-get update && apt-get install -y \
63+
ARG KEA_VERSION
64+
65+
RUN --mount=type=bind,from=download,src=/download,dst=/download \
66+
apt-get update \
67+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
1368
ca-certificates \
1469
dumb-init \
1570
ruby3.0 \
1671
iproute2 \
17-
curl \
72+
/download/*.deb \
1873
&& apt-get clean && rm -rf /var/lib/apt/lists/*
1974

20-
ARG KEA_VERSION=2.0.2-1
21-
RUN apt-get update && apt-get install -y --no-install-recommends \
22-
kea-dhcp4-server=${KEA_VERSION} \
23-
kea-admin=${KEA_VERSION} \
24-
kea-ctrl-agent=${KEA_VERSION} \
25-
&& apt-get clean && rm -rf /var/lib/apt/lists/*
26-
27-
RUN curl -Ssf -o /tmp/stork.deb 'https://sorah-pkg.s3.dualstack.ap-northeast-1.amazonaws.com/misc/isc-stork-agent_1.5.0.220824140136_arm64.deb' \
28-
&& ( echo '1e8b67f2afe4404ea3091cbef14e93a23186633a3d571f9cb141d162350d2fe6235d7679e89bed5c2235433f203d706d /tmp/stork.deb' | sha384sum -c --strict ) \
29-
&& dpkg -i /tmp/stork.deb && rm /tmp/stork.deb
30-
COPY healthz/target/aarch64-unknown-linux-gnu/release/healthz /app/healthzd
31-
75+
COPY --from=build /app/bin/healthz /app/healthzd
3276
COPY run.sh /app/run.sh
3377
COPY choose_dhcp_server_id.rb /app/choose_dhcp_server_id.rb
3478
COPY --from=config /app/kea-ctrl-agent.json /app/kea-ctrl-agent.json
3579

36-
RUN kea-ctrl-agent -t /app/kea-ctrl-agent.json
80+
RUN kea-ctrl-agent -t /app/kea-ctrl-agent.json
3781

3882
CMD /app/run.sh

0 commit comments

Comments
 (0)