-
Notifications
You must be signed in to change notification settings - Fork 172
/
Dockerfile
59 lines (42 loc) · 1.2 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
53
54
55
56
57
58
59
## UI ##
FROM node:18-alpine3.17 as ui-builder
RUN mkdir /app
COPY web-client /app
ENV NODE_OPTIONS=--openssl-legacy-provider
WORKDIR /app
RUN yarn install && yarn build
## BACKEND ##
FROM golang:1.19.5-alpine3.17 as go-base
ENV GOCACHE=/tmp/.go/cache
ENV GOMODCACHE=/tmp/.go/modcache
ENV GOTMPDIR=/tmp/.go/tmp
ENV CGO_ENABLED=0
ARG CLUSTER_NAME
ARG NAMESPACE
ARG PORT
ARG CONTROL_PLANE_ADDRESS
ARG BASIC_AUTH_PASSWORD
ENV CLUSTER_NAME=${CLUSTER_NAME}
ENV CONTROL_PLANE_ADDRESS=${CONTROL_PLANE_ADDRESS}
ENV NAMESPACE=${NAMESPACE}
ENV PORT=${PORT}
ENV BASIC_AUTH_PASSWORD=${BASIC_AUTH_PASSWORD}
RUN mkdir -p /tmp/.go/cache /tmp/.go/modcache /tmp/.go/tmp /app
WORKDIR /app
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
COPY cmd cmd
COPY internal internal
COPY static static
FROM go-base as development
COPY --from=ui-builder /app/build /app/static/build
ENTRYPOINT ["go", "run", "cmd/run-server.go"]
FROM go-base as builder
COPY --from=ui-builder /app/build /app/static/build
RUN go build --tags=release -o permission-manager cmd/run-server.go
FROM scratch as release
WORKDIR /app
COPY --from=builder /app/permission-manager /app/permission-manager
EXPOSE 4000
ENTRYPOINT ["./permission-manager"]