AnthoLume/Dockerfile-BuildKit

30 lines
854 B
Plaintext
Raw Normal View History

2024-04-06 13:39:04 +00:00
# Certificates & Timezones
FROM alpine AS alpine
RUN apk update && apk add --no-cache ca-certificates tzdata
2023-10-24 11:39:37 +00:00
# Build Image
FROM --platform=$BUILDPLATFORM golang:1.21 AS build
2023-10-24 11:39:37 +00:00
# Create Package Directory
WORKDIR /src
2023-11-04 23:40:32 +00:00
RUN mkdir -p /opt/antholume
2023-10-24 11:39:37 +00:00
# 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
2023-10-24 11:39:37 +00:00
# Create Image
FROM busybox:1.36
2024-04-06 13:39:04 +00:00
COPY --from=alpine /etc/ssl/certs /etc/ssl/certs
COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo
2023-11-04 23:40:32 +00:00
COPY --from=build /opt/antholume /opt/antholume
WORKDIR /opt/antholume
2023-10-24 11:39:37 +00:00
EXPOSE 8585
2023-11-04 23:40:32 +00:00
ENTRYPOINT ["/opt/antholume/server", "serve"]