-
Notifications
You must be signed in to change notification settings - Fork 89
/
Dockerfile
41 lines (27 loc) · 851 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
FROM node:16 as frontend_builder
# Set the working directory to /app
WORKDIR /app
# Copy the package.json and package-lock.json files to the container
COPY web/package*.json ./
# Install dependencies
RUN npm install
# Copy the remaining application files to the container
COPY web/ .
# Build the application
RUN npm run build
FROM golang:1.19-alpine3.16 AS builder
WORKDIR /app
COPY api/go.mod api/go.sum ./
RUN go mod download
COPY api/ .
# cp -rf /app/dist/* /app/static/
COPY --from=frontend_builder /app/dist/ ./static/
RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -installsuffix cgo -o /app/app
FROM alpine:3.16
WORKDIR /app
COPY --from=builder /app/app /app
# for go timezone work
COPY --from=builder /usr/local/go/lib/time/zoneinfo.zip /app/zoneinfo.zip
ENV ZONEINFO=/app/zoneinfo.zip
EXPOSE 8080
ENTRYPOINT ["/app/app"]