You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
540 B
Docker
31 lines
540 B
Docker
FROM golang:1.23-alpine AS builder
|
|
|
|
RUN apk add --no-cache git ca-certificates
|
|
|
|
WORKDIR /build
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /build/autohero ./cmd/server
|
|
|
|
# ---
|
|
|
|
FROM alpine:3.19
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata && \
|
|
addgroup -S autohero && \
|
|
adduser -S autohero -G autohero
|
|
|
|
COPY --from=builder /build/autohero /usr/local/bin/autohero
|
|
COPY migrations/ /app/migrations/
|
|
|
|
USER autohero
|
|
WORKDIR /app
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["autohero"]
|