-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (32 loc) · 937 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
35
36
37
38
39
40
41
42
FROM golang:1.15.6-alpine as builder1
# Setting up environment for builder1
ENV GO111MODULE=on
WORKDIR /app/dmanager
# install required package(s)
RUN apk --no-cache add ca-certificates git alpine-sdk
# Copy dependency list
COPY go.mod .
COPY go.sum .
RUN go mod download
# Copy files
COPY ./*.go ./
COPY ./models/*.go ./models/
COPY ./constants/*.go ./constants/
COPY ./services/*.go ./services/
COPY ./handlers/*.go ./handlers/
COPY ./storage/*.go ./storage/
COPY ./handlers/web/*.go ./handlers/web/
# Compile
RUN go build -o main
# Create new stage based on alpine
FROM alpine:latest
#Copy ca certs
COPY --from=builder1 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
# Copy compiled binary from builder1
WORKDIR /app
RUN mkdir /app/data/
COPY --from=builder1 /app/dmanager/main .
COPY ./html ./html
# Set Debuglevel and start the server
ENV DM_LOG_LEVEL debug
CMD [ "/app/main" , "server" , "start" ]