1
- # Docker buildkit multi-arch build requires golang alpine
2
- FROM golang:1.16-alpine as builder
3
-
4
- RUN apk add --no-cache gcc pkgconfig libc-dev binutils-gold musl~=1.2 libgit2-dev~=1.1
1
+ FROM golang:1.16-buster as builder
2
+
3
+ # Up-to-date libgit2 dependencies are only available in
4
+ # >=bullseye (testing).
5
+ RUN echo "deb http://deb.debian.org/debian testing main" >> /etc/apt/sources.list \
6
+ && echo "deb-src http://deb.debian.org/debian testing main" >> /etc/apt/sources.list
7
+ RUN set -eux; \
8
+ apt-get update \
9
+ && apt-get install -y libgit2-dev/testing zlib1g-dev/testing libssh2-1-dev/testing libpcre3-dev/testing \
10
+ && apt-get clean \
11
+ && apt-get autoremove --purge -y \
12
+ && rm -rf /var/lib/apt/lists/*
5
13
6
14
WORKDIR /workspace
7
15
@@ -24,21 +32,26 @@ COPY internal/ internal/
24
32
# build without specifing the arch
25
33
RUN CGO_ENABLED=1 go build -o source-controller main.go
26
34
27
- FROM alpine:3.13
35
+ FROM debian:buster-slim as controller
28
36
29
37
# link repo to the GitHub Container Registry image
30
38
LABEL org.opencontainers.image.source="https://github.com/fluxcd/source-controller"
31
39
32
- RUN apk add --no-cache ca-certificates tini libgit2~=1.1 musl~=1.2
40
+ # Up-to-date libgit2 dependencies are only available in
41
+ # >=bullseye (testing).
42
+ RUN echo "deb http://deb.debian.org/debian testing main" >> /etc/apt/sources.list \
43
+ && echo "deb-src http://deb.debian.org/debian testing main" >> /etc/apt/sources.list
44
+ RUN set -eux; \
45
+ apt-get update \
46
+ && apt-get install -y ca-certificates libgit2-1.1 \
47
+ && apt-get clean \
48
+ && apt-get autoremove --purge -y \
49
+ && rm -rf /var/lib/apt/lists/*
33
50
34
51
COPY --from=builder /workspace/source-controller /usr/local/bin/
35
52
36
- # Create minimal nsswitch.conf file to prioritize the usage of /etc/hosts over DNS queries.
37
- # https://github.com/gliderlabs/docker-alpine/issues/367#issuecomment-354316460
38
- RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
39
-
40
- RUN addgroup -S controller && adduser -S controller -G controller
53
+ RUN groupadd controller && \
54
+ useradd --gid controller --shell /bin/sh --create-home controller
41
55
42
56
USER controller
43
-
44
- ENTRYPOINT [ "/sbin/tini" , "--" , "source-controller" ]
57
+ ENTRYPOINT ["source-controller" ]
0 commit comments