-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
78 lines (46 loc) · 1.46 KB
/
Dockerfile
File metadata and controls
78 lines (46 loc) · 1.46 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
# syntax=docker/dockerfile:1
##
## Build
##
# Alpine is chosen for its small footprint
# compared to Ubuntu
# FROM golang:1.17-alpine3.15 as build
FROM golang:1.17-alpine3.15 as go-build-deps
## We create an /app directory within our
## image that will hold our application source
## files
## We copy everything in the root directory
## into our /app directory
## We specify that we now wish to execute
## any further commands inside our /app
## directory
RUN apk --no-cache --update add ca-certificates
RUN apk update --no-cache && apk add --no-cache wget gzip curl nodejs
RUN wget -O binary-for-linux-64-bit.gz 'https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz'
RUN gzip -d binary-for-linux-64-bit.gz
RUN mv ./binary-for-linux-64-bit /usr/local/bin/elm
## RUN rm binary-for-linux-64-bit.gz
RUN chmod +x /usr/local/bin/elm
WORKDIR /app-go
COPY go/go.mod /app-go
COPY go/go.sum /app-go
RUN go mod download
COPY go/*.go /app-go
RUN go build -o main .
FROM node:16-alpine3.15 as node-build-deps
WORKDIR /app-node
ENV NODE_ENV=production
COPY package.json yarn.lock ./
RUN yarn install --production=false
COPY . /app-node
# COPY src /app-node
RUN yarn run build:prod
FROM nginx:1.21.6-alpine
COPY --from=go-build-deps /app-go/main /server
COPY --from=node-build-deps /app-node/dist /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/nginx.conf
RUN nginx -t
# RUN service nginx restart
RUN nginx
EXPOSE 80 9000
CMD ["/server"]