-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (23 loc) · 750 Bytes
/
Dockerfile
File metadata and controls
44 lines (23 loc) · 750 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
32
33
34
35
36
37
38
39
40
41
42
43
44
# syntax=docker/dockerfile:1
FROM node:18-bullseye
WORKDIR /frontend
COPY frontendV2/ ./
RUN npm install
RUN npm run build
FROM golang:1.18-bullseye
WORKDIR /backend
# COPY funholidaysapi funholidaysapi # if build is a separate step then all the source doesn't have to be copied
COPY main.go go.sum go.mod ./
COPY models/ models/
COPY mongoUtil/ mongoUtil/
RUN go mod download
RUN CGO_ENABLED=0 go build
# this last bit reduces the image size from over a gigabyte to about 20 megabytes
FROM scratch
WORKDIR /app
COPY --from=0 /frontend/public ./frontendV2/public
COPY --from=1 /backend/funholidaysapi ./
COPY --from=1 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY doc.md .env ./
ENV PORT 5000
CMD [ "./funholidaysapi" ]