-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
34 lines (24 loc) · 902 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
FROM golang:1 as builder
ENV NODE_VERSION=16.17.0
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version
RUN npm --version
RUN mkdir /build
ADD . /build/
WORKDIR /build/web
RUN npm install
RUN npm run build
WORKDIR /build
RUN CGO_ENABLED=1 GOOS=linux go build -a -buildvcs=false -installsuffix cgo -ldflags "-extldflags '-static'" -o main github.com/CSSUoB/society-voting
FROM alpine
# the below is needed for the shim script
RUN apk add --no-cache bash
COPY --from=builder /build/main /
COPY --from=builder /build/deploy/prod-shim.sh /
WORKDIR /run
CMD ["../prod-shim.sh", "../main"]