31 lines
545 B
Docker
31 lines
545 B
Docker
# syntax=docker/dockerfile:1
|
|
# docker build --rm -f build/Dockerfile -t source.toby3d.me/toby3d/auth .
|
|
|
|
# Build
|
|
FROM golang:alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
ENV CGO_ENABLED=0
|
|
ENV GOFLAGS="-mod=vendor -buildvcs=true"
|
|
|
|
COPY go.mod go.sum *.go ./
|
|
COPY internal ./internal/
|
|
COPY vendor ./vendor/
|
|
COPY web ./web/
|
|
|
|
RUN apk --no-cache add ca-certificates
|
|
RUN go build -o ./auth
|
|
|
|
# Run
|
|
FROM scratch
|
|
|
|
WORKDIR /
|
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
COPY --from=builder /app/auth /auth
|
|
|
|
EXPOSE 3000
|
|
|
|
ENTRYPOINT ["/auth"]
|