Skip to content

Commit 38b4eb2

Browse files
committed
Enable multi-arch build
Signed-off-by: Stefan Prodan <[email protected]>
1 parent e7ec904 commit 38b4eb2

File tree

4 files changed

+50
-23
lines changed

4 files changed

+50
-23
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
restore-keys: |
2121
${{ runner.os }}-go-
2222
- name: Set up Go
23-
uses: actions/setup-go@v2-beta
23+
uses: actions/setup-go@v2
2424
with:
25-
go-version: 1.14.x
25+
go-version: 1.15.x
2626
- name: Set up kubebuilder
2727
# TODO replace with ../pkg/.. when that's merged
2828
uses: fluxcd/pkg/actions/[email protected]

Dockerfile

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Build the manager binary
2-
FROM golang:1.14 as builder
1+
FROM golang:1.15-alpine as builder
32

43
WORKDIR /workspace
54
# Copy the Go Modules manifests
@@ -16,13 +15,22 @@ COPY pkg/ pkg/
1615
COPY controllers/ controllers/
1716

1817
# Build
19-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
18+
RUN CGO_ENABLED=0 go build -a -o image-automation-controller main.go
2019

21-
# Use distroless as minimal base image to package the manager binary
22-
# Refer to https://github.com/GoogleContainerTools/distroless for more details
23-
FROM gcr.io/distroless/static:nonroot
24-
WORKDIR /
25-
COPY --from=builder /workspace/manager .
26-
USER nonroot:nonroot
20+
FROM alpine:3.12
2721

28-
ENTRYPOINT ["/manager"]
22+
LABEL org.opencontainers.image.source="https://github.com/fluxcd/image-automation-controller"
23+
24+
RUN apk add --no-cache ca-certificates tini
25+
26+
COPY --from=builder /workspace/image-automation-controller /usr/local/bin/
27+
28+
# Create minimal nsswitch.conf file to prioritize the usage of /etc/hosts over DNS queries.
29+
# https://github.com/gliderlabs/docker-alpine/issues/367#issuecomment-354316460
30+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
31+
32+
RUN addgroup -S controller && adduser -S -g controller controller
33+
34+
USER controller
35+
36+
ENTRYPOINT [ "/sbin/tini", "--", "image-automation-controller" ]

config/manager/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
resources:
2-
- manager.yaml
31
apiVersion: kustomize.config.k8s.io/v1beta1
42
kind: Kustomization
3+
resources:
4+
- manager.yaml
55
images:
66
- name: controller
77
newName: fluxcd/image-automation-controller

config/manager/manager.yaml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Deployment
33
metadata:
44
name: image-automation-controller
55
labels:
6-
control-plane: controller-manager
6+
control-plane: controller
77
spec:
88
selector:
99
matchLabels:
@@ -13,19 +13,38 @@ spec:
1313
metadata:
1414
labels:
1515
app: image-automation-controller
16+
annotations:
17+
prometheus.io/scrape: "true"
18+
prometheus.io/port: "8080"
1619
spec:
20+
terminationGracePeriodSeconds: 10
1721
containers:
18-
- command:
19-
- /manager
22+
- name: manager
23+
image: fluxcd/image-automation-controller
24+
imagePullPolicy: IfNotPresent
25+
securityContext:
26+
allowPrivilegeEscalation: false
27+
readOnlyRootFilesystem: true
28+
ports:
29+
- containerPort: 8080
30+
name: http-prom
31+
env:
32+
- name: RUNTIME_NAMESPACE
33+
valueFrom:
34+
fieldRef:
35+
fieldPath: metadata.namespace
2036
args:
2137
- --enable-leader-election
22-
image: fluxcd/image-automation-controller
23-
name: manager
2438
resources:
2539
limits:
26-
cpu: 100m
27-
memory: 30Mi
40+
cpu: 1000m
41+
memory: 1Gi
2842
requests:
2943
cpu: 100m
30-
memory: 20Mi
31-
terminationGracePeriodSeconds: 10
44+
memory: 64Mi
45+
volumeMounts:
46+
- name: temp
47+
mountPath: /tmp
48+
volumes:
49+
- name: temp
50+
emptyDir: {}

0 commit comments

Comments
 (0)