forked from rdegges/ipify-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (26 loc) · 991 Bytes
/
Dockerfile
File metadata and controls
32 lines (26 loc) · 991 Bytes
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
# ipify-api server builder container
FROM golang:alpine3.15 as builder
WORKDIR /usr/src
COPY docker-entrypoint.sh /docker-entrypoint.sh
# ADD ./ /usr/src/ipify-api
RUN sed -i -e 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apk/repositories; \
apk update; \
apk add --no-cache curl ca-certificates wget git ; \
#set the global default user and email
git config --global user.name "AlpineBuilder"; \
git config --global user.email "builder@gmail.com" ; \
# clone the ipify-api code
git clone https://github.com/tekintian/ipify-api.git; \
cd /usr/src/ipify-api ;\
go mod init ; \
go build -v; \
chmod +x ipify-api; \
chmod +x /docker-entrypoint.sh
# ipify-api server run container
FROM alpine:3.8
LABEL maintainer="tekintian@gmail.com"
WORKDIR /usr/local/bin
COPY --from=builder /usr/src/ipify-api/ipify-api .
COPY --from=builder /docker-entrypoint.sh /docker-entrypoint.sh
EXPOSE 3000
ENTRYPOINT ["/docker-entrypoint.sh"]