-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (41 loc) · 1.22 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
60
61
62
FROM golang:1.20.4-alpine3.16 as base
WORKDIR /app
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
RUN apk update \
&& apk add --no-cache \
ca-certificates \
git \
&& update-ca-certificates
FROM node:20.2.0-alpine3.16 as asset-env
WORKDIR /app
COPY web/assets web/assets
COPY package.json .
COPY yarn.lock .
RUN yarn install
RUN yarn build
### Development with hot reload and debugger
FROM base AS dev
WORKDIR /app
COPY --from=asset-env /app/web/static web/static
RUN go install github.com/cosmtrek/air@latest && go install github.com/go-delve/delve/cmd/dlv@latest
EXPOSE 8080
EXPOSE 2345
ENTRYPOINT ["air"]
FROM base as build-env
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN go build -a -installsuffix cgo -o /go/bin/opg-sirius-supervision-firm-deputy-hub
FROM alpine:3
WORKDIR /go/bin
RUN apk --update --no-cache add ca-certificates tzdata
# Patch vulnerabilities
RUN apk upgrade --no-cache libcrypto3 libssl3
COPY --from=build-env /go/bin/opg-sirius-supervision-firm-deputy-hub opg-sirius-supervision-firm-deputy-hub
COPY --from=build-env /app/web/template web/template
COPY --from=asset-env /app/web/static web/static
ENTRYPOINT ["./opg-sirius-supervision-firm-deputy-hub"]