-
Notifications
You must be signed in to change notification settings - Fork 159
/
Dockerfile
54 lines (38 loc) · 1.1 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
ARG GOLANG_VERSION
ARG TARGETARCH
ARG VERSION
ARG BASE_REGISTRY
ARG BASE_IMAGE
ARG PLATFORM
FROM --platform=${PLATFORM} docker.io/library/golang:${GOLANG_VERSION}-alpine AS builder
LABEL stage=tileservbuilder
ARG TARGETARCH
ARG VERSION
WORKDIR /app
COPY . ./
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -v -ldflags "-s -w -X main.programVersion=${VERSION}"
FROM --platform=${TARGETARCH} ${BASE_REGISTRY}/${BASE_IMAGE} AS multi-stage
COPY --from=builder /app/pg_tileserv /app/
COPY --from=builder /app/assets /app/assets
VOLUME ["/config"]
USER 1001
EXPOSE 7800
WORKDIR /app
ENTRYPOINT ["/app/pg_tileserv"]
CMD []
FROM --platform=${PLATFORM} ${BASE_REGISTRY}/${BASE_IMAGE} AS local
RUN mkdir /app
ADD ./pg_tileserv /app/
ADD ./assets /app/assets
VOLUME ["/config"]
USER 1001
EXPOSE 7800
WORKDIR /app
ENTRYPOINT ["/app/pg_tileserv"]
CMD []
# To build
# make APPVERSION=1.0.2 clean docker
# To build using binaries from golang docker image
# make APPVERSION=1.0.2 clean multi-stage-docker
# To run
# docker run -dt -e DATABASE_URL=postgres://user:pass@host/dbname -p 7800:7800 pramsey/pg_tileserv:1.0.2