-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (52 loc) · 1.59 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM golang:1.16-alpine as builder
# Add Maintainer Info
LABEL maintainer="Sam Zhou <[email protected]>"
# Set the Current Working Directory inside the container
WORKDIR /app
# Copy the source from the current directory to the Working Directory inside the container
COPY . .
# Build the Go app
RUN go version \
&& export GO111MODULE=on \
&& export GOPROXY=https://goproxy.io \
&& go mod vendor \
&& CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o email2db \
&& chmod +x email2db
######## Start a new stage from scratch #######
FROM alpine:latest
RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64 \
&& chmod +x /usr/local/bin/dumb-init \
&& apk add --update libintl \
&& apk add --virtual build_deps gettext \
&& apk add --no-cache tzdata \
&& cp /usr/bin/envsubst /usr/local/bin/envsubst \
&& apk del build_deps
WORKDIR /app
# Copy the Pre-built binary file from the previous stage
COPY --from=builder /app/email2db .
COPY ./config.json .
COPY ./web /app/web
ENV HTTP_LIST="0.0.0.0:8843" \
S3_KEY="" \
S3_SECRET="" \
S3_SECRET="" \
S3_REGION="ap-southeast-1" \
S3_PREFIX="email2db" \
S3_BUCKET="s3.test.mixmedia.com" \
MYSQL_HOST="" \
MYSQL_PORT=3306 \
MYSQL_DATABASE="email2db" \
MYSQL_USERNAME="" \
MYSQL_PASSWORD="" \
PARSER_TYPE="pop3" \
ZOHO_POP3_HOST="" \
ZOHO_POP3_PORT=995 \
ZOHO_EMAIL="" \
ZOHO_APP_SECRET="" \
ZOHO_POP3_TLS=true \
TZ="Asia/Hong_Kong" \
WEB_ROOT=/app/web
EXPOSE 8843
ENTRYPOINT ["dumb-init", "--"]
CMD envsubst < /app/config.json > /app/temp.json \
&& /app/email2db -c /app/temp.json