forked from iselegant/cnappdemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
25 lines (24 loc) · 820 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
# Multi stage building strategy for reducing image size.
FROM golang:1.13.5-alpine3.10 AS build-env
ENV GO111MODULE=on
RUN mkdir /app
ADD . /app
WORKDIR /app
# Use "Ultimate Packer for eXecutables". ref: https://upx.github.io/
RUN apk add --no-cache --virtual .go-builddeps git gcc make build-base alpine-sdk upx&& \
go mod download && \
go get golang.org/x/lint/golint && \
make validate && \
make build-linux && \
go get github.com/pwaller/goupx && \
goupx main
# If use TLS connection in container, add ca-certificates following command.
# > RUN apk add --no-cache ca-certificates
FROM alpine:3.10.3
RUN mkdir /app && \
apk add --no-cache tzdata&& \
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
WORKDIR /app
COPY --from=build-env /app/main /app
EXPOSE 80
ENTRYPOINT ["/app/main"]