Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run on Alpine #13

Merged
merged 1 commit into from
Feb 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 13 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
# build stage
FROM golang:1 AS build
FROM golang:1.20-alpine AS build

ENV \
STRONGBOX_VERSION=1.0.1 \
STRONGBOX_VERSION=1.1.0 \
KUSTOMIZE_VERSION=v5.0.0

RUN os=$(go env GOOS) && arch=$(go env GOARCH) \
&& 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
&& 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 .
&& go build -ldflags='-s -w' -o /argocd-voodoobox-plugin .

# final stage
# argocd requires that sidecar container is running as user 999
FROM ubuntu:22.04
FROM alpine:3.17

USER root

ENV ARGOCD_USER_ID=999

RUN groupadd -g $ARGOCD_USER_ID argocd && \
useradd -r -u $ARGOCD_USER_ID -g argocd argocd && \
apt-get update && \
apt-get -y upgrade && \
apt-get install -y git git-lfs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN adduser -S -H -u $ARGOCD_USER_ID argocd \
&& apk --no-cache add git git-lfs

COPY --from=build \
/usr/local/bin/kustomize \
Expand Down