-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
52 lines (36 loc) · 1.02 KB
/
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
50
51
52
# Build the front app
FROM node:21 as front
# Create app directory
RUN mkdir -p /usr/src/front
WORKDIR /usr/src/front
# Installing dependencies
COPY front/package*.json /usr/src/front/
RUN npm install
# Copying source files
COPY front /usr/src/front
# Building app
RUN npm run build
# Export the app to /usr/src/front/out
RUN npm run export
# Build the server
FROM golang:1.21 as server
RUN mkdir -p /usr/src/server
WORKDIR /usr/src/server
# First download dependencies (to benefit from docker cache)
COPY server/go.mod /usr/src/server
COPY server/go.sum /usr/src/server
RUN go mod download
# Then build the app
COPY server .
ENV CGO_ENABLED=0
RUN go build -o ./app
# Copy the binary into base image
FROM gcr.io/distroless/base
COPY --from=front /usr/src/front/out ../front/out
COPY --from=server /usr/src/server/app .
COPY --from=server /usr/src/server/config_example.yaml .
COPY --from=server /usr/src/server/templates/ ./templates
EXPOSE 8080
CMD ["/app", "web"]
LABEL name="istio-redirector"
LABEL version_auto_semver="true"