Skip to content

Commit

Permalink
Merge pull request #13 from utilitywarehouse/alpine
Browse files Browse the repository at this point in the history
Run on Alpine
  • Loading branch information
asiyani authored Feb 23, 2023
2 parents 5dbb0be + acd7414 commit e325513
Showing 1 changed file with 13 additions and 20 deletions.
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

0 comments on commit e325513

Please sign in to comment.