-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
42 lines (37 loc) · 1.31 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
FROM golang AS build
ADD . /go/src/github.com/special-tactical-service/wiki
WORKDIR /go/src/github.com/special-tactical-service/wiki
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh && bash nodesource_setup.sh && \
apt-get install -y nodejs
# build backend
ENV GOPATH=/go
ENV CGO_ENABLED=0
RUN go build -ldflags "-s -w" main.go
# build frontend
RUN cd /go/src/github.com/special-tactical-service/wiki/public && \
npm i && \
npm rebuild node-sass && \
npm run build
RUN rm -r /go/src/github.com/special-tactical-service/wiki/public/node_modules && \
rm -r /go/src/github.com/special-tactical-service/wiki/public/src && \
rm /go/src/github.com/special-tactical-service/wiki/public/package.json && \
rm /go/src/github.com/special-tactical-service/wiki/public/package-lock.json && \
rm /go/src/github.com/special-tactical-service/wiki/public/webpack.config.js
FROM alpine
RUN apk update && \
apk upgrade && \
apk add --no-cache && \
apk add ca-certificates && \
rm -rf /var/cache/apk/*
COPY --from=build /go/src/github.com/special-tactical-service/wiki /app
WORKDIR /app
# default config
ENV STS_WIKI_LOGLEVEL=info
ENV STS_WIKI_ALLOWED_ORIGINS=*
ENV STS_WIKI_HOST=0.0.0.0:80
EXPOSE 80
EXPOSE 443
CMD ["/app/main"]