AnthoLume/Dockerfile-BuildKit

29 lines
774 B
Plaintext
Raw Normal View History

2023-10-24 11:39:37 +00:00
# Certificate Store
FROM alpine AS certs
RUN apk update && apk add ca-certificates
# Build Image
FROM --platform=$BUILDPLATFORM golang:1.20 AS build
# 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 \
2023-11-04 23:40:32 +00:00
GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /opt/antholume/server; \
cp -a ./templates /opt/antholume/templates; \
cp -a ./assets /opt/antholume/assets;
2023-10-24 11:39:37 +00:00
# Create Image
FROM busybox:1.36
COPY --from=certs /etc/ssl/certs /etc/ssl/certs
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"]