-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (26 loc) · 869 Bytes
/
Dockerfile
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM golang:1.21-alpine as oapi-codegen-download
RUN go install github.com/deepmap/oapi-codegen/v2/cmd/[email protected]
FROM node:21-alpine as api-gen
WORKDIR /api
COPY --from=oapi-codegen-download /go/bin/oapi-codegen /
ENV PATH="${PATH}:/"
COPY ./api /api
WORKDIR /api
RUN npm run generate-go
FROM golang:1.21-alpine as builder
COPY --from=api-gen /api /api
WORKDIR /api
RUN go mod download
WORKDIR /swimlogs
COPY ./backend/go.mod ./backend/go.sum ./
RUN go mod download
COPY ./backend ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /swimlogs-app
FROM alpine:3.19
WORKDIR /
COPY --from=builder /swimlogs/migrations /migrations
COPY --from=builder /swimlogs-app /swimlogs-app
EXPOSE 42069
HEALTHCHECK --interval=5s --timeout=3s --retries=3 \
CMD wget --tries=1 --spider http://localhost:42069/monitoring/heartbeat || exit 1
CMD ["/swimlogs-app"]