-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
31 lines (28 loc) · 989 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
# ============================================================
# Build stage 1: Build UI
# ============================================================
FROM node:16-alpine as node-builder
WORKDIR /src/ui
COPY ui .
RUN yarn
RUN yarn lib build
RUN yarn app build
# ============================================================
# Build stage 2: Build API
# ============================================================
FROM golang:1.22-alpine as go-builder
WORKDIR /src/api
COPY api api/
COPY go.mod .
COPY go.sum .
COPY db-migrations ./db-migrations
RUN go build -o bin/mlp-api ./api/main.go
# ============================================================
# Build stage 3: Run the app
# ============================================================
FROM alpine:3.16
COPY --from=node-builder /src/ui/build ./ui/build
COPY --from=go-builder /src/api/bin/mlp-api /usr/bin/mlp
COPY --from=go-builder /src/api/db-migrations ./db-migrations
ENTRYPOINT ["sh", "-c", "mlp \"$@\"", "--"]
CMD ["serve"]