AnthoLume/Dockerfile-BuildKit
Evan Reichard a7ecb1a6f8
All checks were successful
continuous-integration/drone/push Build is passing
fix(tz): add tzdata to docker image
2024-04-06 09:39:04 -04:00

30 lines
854 B
Plaintext

# Certificates & Timezones
FROM alpine AS alpine
RUN apk update && apk add --no-cache ca-certificates tzdata
# Build Image
FROM --platform=$BUILDPLATFORM golang:1.21 AS build
# Create Package Directory
WORKDIR /src
RUN mkdir -p /opt/antholume
# Cache Dependencies & Compile
ARG TARGETOS
ARG TARGETARCH
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
GOOS=$TARGETOS GOARCH=$TARGETARCH go build \
-ldflags "-X reichard.io/antholume/config.version=`git describe --tags`" \
-o /opt/antholume/server
# Create Image
FROM busybox:1.36
COPY --from=alpine /etc/ssl/certs /etc/ssl/certs
COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=build /opt/antholume /opt/antholume
WORKDIR /opt/antholume
EXPOSE 8585
ENTRYPOINT ["/opt/antholume/server", "serve"]