-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
55 lines (41 loc) · 1.35 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
# Build Stage
#FROM golang:1.21.1-alpine3.18 AS build-stage
FROM golang:alpine AS build-stage
LABEL app="build-ip2location-pfsense"
LABEL REPO="https://github.com/jpmchia/ip2location-pfsense"
ENV PROJPATH=/go/src/github.com/jpmchia/ip2ocation-pfsense/backend
# Because of https://github.com/docker/docker/issues/14914
#ENV PATH=$PATH:$GOROOT/bin:$GOPATH/bin
ADD . /go/src/github.com/jpmchia/ip2location-pfsense
WORKDIR /go/src/github.com/jpmchia/ip2location-pfsense
RUN apk add --no-cache --update curl \
dumb-init \
bash \
grep \
sed \
jq \
ca-certificates \
openssl \
git \
make \
gcc \
musl-dev \
&& rm -rf /var/cache/apk/*
RUN make build-alpine
# Final Stage
FROM alpine:latest
ARG GIT_COMMIT
ARG VERSION
LABEL REPO="https://github.com/jpmchia/ip2location-pfsense"
LABEL GIT_COMMIT=$GIT_COMMIT
LABEL VERSION=$VERSION
# Because of https://github.com/docker/docker/issues/14914
ENV PATH=$PATH:/opt/ip2location-pfsense/bin
WORKDIR /opt/ip2location/bin
COPY --from=build-stage /go/src/github.com/jpmchia/ip2location-pfsense/backend/bin/ip2location-pfsense /opt/ip2location-pfsense/bin/
RUN chmod +x /opt/ip2location-pfsense/bin/ip2location-pfsense
# Create appuser
RUN adduser -D -g '' ip2location
USER ip2location
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/opt/ip2location-pfsense/bin/ip2location-pfsense", "service"]