-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
40 lines (30 loc) · 1.15 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM golang:1.23-alpine AS build
ENV \
STRONGBOX_VERSION=2.0.0-RC4 \
KUSTOMIZE_VERSION=v5.5.0
RUN os=$(go env GOOS) && arch=$(go env GOARCH) \
&& apk --no-cache add curl \
&& curl -Ls https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_${os}_${arch}.tar.gz \
| tar xz -C /usr/local/bin/ \
&& chmod +x /usr/local/bin/kustomize \
&& curl -Ls https://github.com/uw-labs/strongbox/releases/download/v${STRONGBOX_VERSION}/strongbox_${STRONGBOX_VERSION}_${os}_${arch} \
> /usr/local/bin/strongbox \
&& chmod +x /usr/local/bin/strongbox
ADD . /app
WORKDIR /app
RUN go test -v -cover ./... \
&& go build -ldflags='-s -w' -o /argocd-voodoobox-plugin .
# final stage
# argocd requires that sidecar container is running as user 999
FROM alpine:3.20
USER root
ENV ARGOCD_USER_ID=999
RUN adduser -S -H -u $ARGOCD_USER_ID argocd \
&& apk --no-cache add git openssh-client git-lfs
COPY --from=build \
/usr/local/bin/kustomize \
/usr/local/bin/strongbox \
/argocd-voodoobox-plugin \
/usr/local/bin/
ENV USER=argocd
USER $ARGOCD_USER_ID