-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (26 loc) · 935 Bytes
/
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
######## Part 1: Environment for building the node client
FROM node:14-alpine as clientBuilder
ENV HOME=/go/src/github.com/jeantanzj/angular-gingonic/client
WORKDIR $HOME
# Install tool needed for building client
RUN npm install -g @angular/cli
# Install client dependecies
COPY ./client/package.json .
RUN npm install
# Copy client files over and build it
COPY ./client .
RUN ng build --prod=true
######## Part 2: Environment for running Go server
FROM golang:1.14-alpine
ENV HOME=/go/src/github.com/jeantanzj/angular-gingonic
WORKDIR $HOME
# Copy the built files over from the previous stage, so that the server can serve these static files
COPY --from=clientBuilder $HOME/client/dist ./client/dist
# Install server dependencies
COPY ./go.mod .
RUN go mod download
# Copy server files over
COPY ./app ./app
EXPOSE 4300
# Run the server in production mode
CMD export GIN_MODE=release && go build -o /tmp/app ./app/ && /tmp/app