Skip to content

Commit 5ba9ef9

Browse files
authored
Merge pull request #187 from fluxcd/debian
Use Debian as base image
2 parents b28f23a + c309c95 commit 5ba9ef9

File tree

2 files changed

+40
-22
lines changed

2 files changed

+40
-22
lines changed

.github/actions/run-tests/Dockerfile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
FROM golang:1.16-alpine
1+
FROM golang:1.16-buster as builder
22

3-
# Add any build or testing essential system packages
4-
RUN apk add --no-cache build-base git pkgconf
5-
RUN apk add --no-cache libgit2-dev~=1.1
6-
RUN apk add --no-cache curl
3+
# Up-to-date libgit2 dependencies are only available in sid (unstable).
4+
RUN echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list \
5+
&& echo "deb-src http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list
6+
RUN set -eux; \
7+
apt-get update \
8+
&& apt-get install -y libgit2-dev/unstable zlib1g-dev/unstable libssh2-1-dev/unstable libpcre3-dev/unstable \
9+
&& apt-get clean \
10+
&& apt-get autoremove --purge -y \
11+
&& rm -rf /var/lib/apt/lists/*
712

8-
# Use the GitHub Actions uid:gid combination for proper fs permissions
9-
RUN addgroup -g 116 -S test && adduser -u 1001 -S -g test test
13+
RUN groupadd -g 116 test && \
14+
useradd -u 1001 --gid test --shell /bin/sh --create-home test
1015

1116
# Run as test user
1217
USER test

Dockerfile

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
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

614
WORKDIR /workspace
15+
716
# Copy the Go Modules manifests
817
COPY go.mod go.mod
918
COPY go.sum go.sum
@@ -24,23 +33,27 @@ COPY controllers/ controllers/
2433
# Build
2534
RUN 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

2938
LABEL 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

3652
COPY --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

4457
USER controller
4558

46-
ENTRYPOINT [ "/sbin/tini", "--", "image-automation-controller" ]
59+
ENTRYPOINT [ "image-automation-controller" ]

0 commit comments

Comments
 (0)