-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
65 lines (44 loc) · 1.3 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
63
64
65
FROM golang:1.19.4-alpine 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:19.4.0-alpine3.16 as asset-env
WORKDIR /app
COPY web/assets web/assets
COPY webpack.config.js .
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-deputy-hub
FROM alpine:3.17.1
WORKDIR /go/bin
RUN apk --update --no-cache add \
ca-certificates && \
apk upgrade busybox --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main && \
rm -rf /var/cache/apk/*
RUN apk --no-cache add tzdata
COPY --from=build-env /go/bin/opg-sirius-supervision-deputy-hub opg-sirius-supervision-deputy-hub
COPY --from=build-env /app/web/template web/template
COPY --from=asset-env /app/web/static web/static
ENTRYPOINT ["./opg-sirius-supervision-deputy-hub"]