forked from Arlandaren/notification-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (17 loc) · 686 Bytes
/
Dockerfile
File metadata and controls
31 lines (17 loc) · 686 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
30
31
FROM golang:1.23.6-alpine AS builder
RUN apk update && apk add --no-cache ca-certificates git gcc g++ libc-dev binutils
WORKDIR /opt
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN find ./ -name '*~' -delete
RUN go mod tidy
RUN go build -o bin/app ./cmd/app/main.go
RUN go build -o bin/migrator ./cmd/migrator/main.go
FROM alpine AS runner
RUN apk update && apk add --no-cache ca-certificates libc6-compat bash && rm -rf /var/cache/apk/**
WORKDIR /opt
COPY --from=builder /opt/migrations ./migrations
COPY --from=builder /opt/bin/app ./
COPY --from=builder /opt/bin/migrator ./
CMD ["sh", "-c", "./migrator -migrations-path=./migrations && ./app"]