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

chore: standardize dockerfile #561

Merged
merged 1 commit into from
Oct 9, 2024
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: 11 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,14 @@ FROM docker.io/library/golang:1.19-alpine as builder

WORKDIR /src

ARG VERSION
ARG GITCOMMIT
ARG BUILDTIME

RUN apk add --no-cache --no-progress \
ca-certificates \
curl \
git \
openssh \
gcc \
libc-dev

curl

# Download spruce here to eliminate the need for curl in the final image
RUN mkdir -p /go/bin && \
arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
curl -L -o /go/bin/spruce https://github.com/geofffranks/spruce/releases/download/v1.30.2/spruce-linux-${arch} && \
chmod +x /go/bin/spruce && \
sha1sum /go/bin/spruce
curl -L -o /go/bin/spruce https://github.com/geofffranks/spruce/releases/download/v1.29.0/spruce-linux-amd64 && \
chmod +x /go/bin/spruce

COPY . .

Expand All @@ -33,18 +23,17 @@ FROM alpine:latest

# Copy over the standard things you'd expect.
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /src/caduceus /
COPY --from=builder /src/.release/docker/entrypoint.sh /
COPY caduceus /
COPY .release/docker/entrypoint.sh /

# Copy over spruce and the spruce template file used to make the actual configuration file.
COPY --from=builder /src/.release/docker/caduceus_spruce.yaml /tmp/caduceus_spruce.yaml
COPY --from=builder /go/bin/spruce /bin/
COPY .release/docker/caduceus_spruce.yaml /tmp/caduceus_spruce.yaml
COPY --from=builder /go/bin/spruce /bin/

# Include compliance details about the container and what it contains.
COPY --from=builder /src/Dockerfile \
/src/NOTICE \
/src/LICENSE \
/src/CHANGELOG.md /
COPY Dockerfile /
COPY NOTICE /
COPY LICENSE /

# Make the location for the configuration file that will be used.
RUN mkdir /etc/caduceus/ \
Expand Down