-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (35 loc) · 1.28 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
FROM golang:1.12.3-stretch AS build
MAINTAINER "Diogo Xavier <diogoxavierpinto@gmail.com>"
WORKDIR /go/src/github.com/diogox/REST-JWT
COPY . .
RUN rm -rf ./vendor
# Install dep
RUN apt-get install curl git openssl
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
# Deploy prisma
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get -y install nodejs
RUN npm install -g prisma
RUN prisma generate
RUN sed -i 's/localhost:4467/prisma:4467/g' prisma.yml
RUN dep ensure -v
# Build website
WORKDIR ./web
RUN npm run build
WORKDIR ./../server
# Workaround env vars not being set in multi-stage build
#RUN cp ./email_body.html ../email_body.html
EXPOSE 8090
CMD ["go", "run", "./cmd/main.go"]
# Build smallest binary possible
#RUN CGO_ENABLED=0 go build -o rest-server -ldflags="-s -w" server/cmd/main.go
# Compress binary even further
#RUN apt-get install -y upx
#RUN upx --brute rest-server
# Make smaller image with just the executable
#FROM alpine
#COPY --from=build /go/src/github.com/diogox/REST-JWT/rest-server /server/rest-server
#COPY --from=build /go/src/github.com/diogox/REST-JWT/server/email_body.html /server/email_body.html
#COPY --from=build /go/src/github.com/diogox/REST-JWT/web/build /web/build/
#EXPOSE 8090
#CMD ["server/rest-server"]