-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (26 loc) · 785 Bytes
/
Copy pathDockerfile
File metadata and controls
29 lines (26 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FROM golang:1.25.11-alpine AS builder
WORKDIR /app
RUN apk --no-cache add make
RUN CGO_ENABLED=0 go install github.com/pressly/goose/v3/cmd/goose@v3.27.1
RUN CGO_ENABLED=0 go install github.com/swaggo/swag/cmd/swag@v1.16.4
RUN CGO_ENABLED=0 go install github.com/dmarkham/enumer@v1.6.3
FROM alpine:3.23 AS migrate
WORKDIR /app
COPY --from=builder /go/bin/goose /bin
COPY scripts/migrate.sh .
COPY migrations migrations
ENTRYPOINT [ "sh", "migrate.sh", "up" ]
FROM builder AS server_builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY pkg pkg
COPY cmd cmd
COPY internal internal
COPY Makefile .
RUN CGO_ENABLED=0 make generate test bin/server
FROM scratch AS server
COPY --from=server_builder /app/bin/server .
EXPOSE 8080
USER 65535:65535
ENTRYPOINT [ "/server" ]