-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
50 lines (39 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
43
44
45
46
47
48
49
50
# base build image
FROM registry.cn-shenzhen.aliyuncs.com/infrastlabs/golang:1.13.9-alpine3.10 as gomod
ARG dir=/go/src/devcn.fun/infrastlabs/ingsitemap
# use go modules
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn
# only copy go.mod and go.sum
WORKDIR ${dir}
COPY go.mod .
COPY go.sum .
RUN go mod download
# Build the manager binary
# FROM registry.cn-shenzhen.aliyuncs.com/infrastlabs/golang:1.13.9-alpine3.10 as builder
FROM gomod AS builder
ARG dir=/go/src/devcn.fun/infrastlabs/ingsitemap
# use go modules
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn
# Build
RUN domain="mirrors.aliyun.com" \
&& echo "http://$domain/alpine/v3.8/main" > /etc/apk/repositories \
&& echo "http://$domain/alpine/v3.8/community" >> /etc/apk/repositories \
&& apk add curl tree bash git && go get -u github.com/go-bindata/go-bindata/...
# Copy in the go src
WORKDIR ${dir}
COPY . .
RUN pwd && bash go-build.sh
# RUN pwd && ls -h && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o ingsitemap ${dir}/
# Copy data into a empty image
FROM registry.cn-shenzhen.aliyuncs.com/infrastlabs/alpine-ext
MAINTAINER sam <[email protected]>
ARG dir=/go/src/devcn.fun/infrastlabs/ingsitemap
USER root
WORKDIR /app
COPY --from=builder ${dir}/ingsitemap /app
# Configure Docker Container
# VOLUME ["/data"]
# EXPOSE 8000
ENTRYPOINT ["./ingsitemap"]