1- FROM golang:1.16-alpine as builder
2-
3- # These are so as to be able to build with libgit2
4- RUN apk add --no-cache gcc pkgconfig libc-dev 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 sid (unstable).
4+ # The libgit2 dependencies must be listed here to be able to build on ARM64.
5+ RUN echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list \
6+ && echo "deb-src http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list
7+ RUN set -eux; \
8+ apt-get update \
9+ && apt-get install -y libgit2-dev/unstable zlib1g-dev/unstable libssh2-1-dev/unstable libpcre3-dev/unstable \
10+ && apt-get clean \
11+ && apt-get autoremove --purge -y \
12+ && rm -rf /var/lib/apt/lists/*
513
614WORKDIR /workspace
15+
716# Copy the Go Modules manifests
817COPY go.mod go.mod
918COPY go.sum go.sum
@@ -24,23 +33,27 @@ COPY controllers/ controllers/
2433# Build
2534RUN CGO_ENABLED=1 go build -o image-automation-controller main.go
2635
27- FROM alpine:3.13
36+ FROM debian:buster-slim as controller
2837
2938LABEL org.opencontainers.image.source="https://github.com/fluxcd/image-automation-controller"
3039
31- RUN apk add --no-cache ca-certificates tini
32-
33- # For libgit2 -- just the runtime libs this time
34- RUN apk add --no-cache musl~=1.2 libgit2~=1.1
40+ # Up-to-date libgit2 dependencies are only available in
41+ # unstable, as libssh2 in testing/bullseye has been linked
42+ # against gcrypt which causes issues with PKCS* formats.
43+ RUN echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list \
44+ && echo "deb-src http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list
45+ RUN set -eux; \
46+ apt-get update \
47+ && apt-get install -y ca-certificates libgit2-1.1 \
48+ && apt-get clean \
49+ && apt-get autoremove --purge -y \
50+ && rm -rf /var/lib/apt/lists/*
3551
3652COPY --from=builder /workspace/image-automation-controller /usr/local/bin/
3753
38- # Create minimal nsswitch.conf file to prioritize the usage of /etc/hosts over DNS queries.
39- # https://github.com/gliderlabs/docker-alpine/issues/367#issuecomment-354316460
40- RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
41-
42- RUN addgroup -S controller && adduser -S controller -G controller
54+ RUN groupadd controller && \
55+ useradd --gid controller --shell /bin/sh --create-home controller
4356
4457USER controller
4558
46- ENTRYPOINT [ "/sbin/tini" , "--" , " image-automation-controller" ]
59+ ENTRYPOINT [ "image-automation-controller" ]
0 commit comments