Skip to content

Commit 069a789

Browse files
authored
feat: docker for channel manager (#1785)
# Description docker file for channel manager ## Type of Change - [ ] Bugfix - [x] New Feature - [ ] Breaking Change - [ ] Refactor - [ ] Documentation - [ ] Other (please describe) ## Checklist - [x] I have read the [contributing guidelines](/agntcy/repo-template/blob/main/CONTRIBUTING.md) - [x] Existing issues have been referenced (where applicable) - [x] I have verified this change is not present in other open pull requests - [x] Functionality is documented - [x] All code style checks pass - [x] New code contribution is covered by automated tests - [x] All new and existing tests pass --------- Signed-off-by: Michele Papalini <micpapal@cisco.com>
1 parent 979bb4f commit 069a789

3 files changed

Lines changed: 64 additions & 1 deletion

File tree

.release-plz.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,9 @@ name = "agntcy-slim-control-plane"
9090
publish = false
9191
release = true
9292
changelog_update = true
93+
94+
[[package]]
95+
name = "agntcy-slim-channel-manager"
96+
publish = false
97+
release = true
98+
changelog_update = true

Dockerfile

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,19 @@ esac
7171
task -v fetch TARGET=${RUSTARCH}
7272

7373
# Build application
74-
task -v build:strip TARGET=${RUSTARCH} PROFILE=release ARGS="--locked --bin slim --bin slim-control-plane"
74+
task -v build:strip TARGET=${RUSTARCH} PROFILE=release ARGS="--locked --bin slim --bin slim-control-plane --bin channel-manager"
7575
mv target/${RUSTARCH}/release/slim /slim
7676
mv target/${RUSTARCH}/release/slim.dbg /slim.dbg
7777

7878
# Strip and export control plane binary
7979
task -v strip TARGET_BIN=target/${RUSTARCH}/release/slim-control-plane
8080
mv target/${RUSTARCH}/release/slim-control-plane /slim-control-plane
8181
mv target/${RUSTARCH}/release/slim-control-plane.dbg /slim-control-plane.dbg
82+
83+
# Strip and export channel manager binary
84+
task -v strip TARGET_BIN=target/${RUSTARCH}/release/channel-manager
85+
mv target/${RUSTARCH}/release/channel-manager /channel-manager
86+
mv target/${RUSTARCH}/release/channel-manager.dbg /channel-manager.dbg
8287
EOF
8388

8489
# Grab libgcc from the CC image
@@ -125,3 +130,26 @@ COPY --from=libgcc-provider /lib/*-linux-gnu/libgcc_s.so.1 /lib/
125130
COPY --from=rust /slim-control-plane /slim-control-plane
126131

127132
ENTRYPOINT ["/slim-control-plane"]
133+
134+
135+
# Runtime image - channel manager debug executable, debug symbols and a shell
136+
FROM debian:bookworm-slim AS channel-manager-debug
137+
138+
ARG TARGETARCH
139+
140+
# copy the build artifacts from the build stage
141+
COPY --from=rust /channel-manager /channel-manager
142+
COPY --from=rust /channel-manager.dbg /channel-manager.dbg
143+
144+
# Runtime image - channel manager release executable
145+
FROM gcr.io/distroless/base-nossl-debian12:nonroot AS channel-manager-release
146+
147+
ARG TARGETARCH
148+
149+
# Copy libgcc from the libgcc-provider image
150+
COPY --from=libgcc-provider /lib/*-linux-gnu/libgcc_s.so.1 /lib/
151+
152+
# copy the artifacts from the build stage
153+
COPY --from=rust /channel-manager /channel-manager
154+
155+
ENTRYPOINT ["/channel-manager"]

docker-bake.hcl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function "get_tag" {
1212
params = [tags, name]
1313
// Check if IMAGE_REPO ends with name to avoid repetition
1414
result = [for tag in coalescelist(tags, [IMAGE_TAG]):
15+
IMAGE_REPO == "" ? "${name}:${tag}" :
1516
can(regex("${name}$", IMAGE_REPO)) ?
1617
"${IMAGE_REPO}:${tag}" :
1718
"${IMAGE_REPO}/${name}:${tag}"
@@ -31,6 +32,12 @@ group "control-plane" {
3132
]
3233
}
3334

35+
group "channel-manager" {
36+
targets = [
37+
"channel-manager",
38+
"channel-manager-debug",
39+
]
40+
}
3441

3542
target "_common" {
3643
output = [
@@ -89,3 +96,25 @@ target "control-plane-debug" {
8996
]
9097
tags = get_tag(target.docker-metadata-action.tags, "${target.control-plane-debug.name}")
9198
}
99+
100+
target "channel-manager" {
101+
context = "."
102+
dockerfile = "./Dockerfile"
103+
target = "channel-manager-release"
104+
inherits = [
105+
"_common",
106+
"docker-metadata-action",
107+
]
108+
tags = get_tag(target.docker-metadata-action.tags, "${target.channel-manager.name}")
109+
}
110+
111+
target "channel-manager-debug" {
112+
context = "."
113+
dockerfile = "./Dockerfile"
114+
target = "channel-manager-debug"
115+
inherits = [
116+
"_common",
117+
"docker-metadata-action",
118+
]
119+
tags = get_tag(target.docker-metadata-action.tags, "${target.channel-manager-debug.name}")
120+
}

0 commit comments

Comments
 (0)