-
Notifications
You must be signed in to change notification settings - Fork 159
/
Dockerfile.alpine
46 lines (37 loc) · 1.26 KB
/
Dockerfile.alpine
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
# Lightweight Alpine-based pg_tileserv Docker Image
# Author: Just van den Broecke
FROM golang:1.21.3-alpine3.17
# Build ARGS
ARG VERSION="latest-alpine-3.17"
RUN mkdir /app
ADD . /app/
WORKDIR /app
RUN go build -v -ldflags "-s -w -X main.programVersion=${VERSION}"
# Multi-stage build: only copy build result and resources
FROM alpine:3.17
LABEL original_developer="Crunchy Data" \
contributor="Just van den Broecke <[email protected]>" \
vendor="Crunchy Data" \
url="https://crunchydata.com" \
release="${VERSION}" \
org.opencontainers.image.vendor="Crunchy Data" \
os.version="3.17"
RUN apk --no-cache add ca-certificates && mkdir /app
WORKDIR /app/
COPY --from=0 /app/pg_tileserv /app/
COPY --from=0 /app/assets /app/assets
VOLUME ["/config"]
USER 1001
EXPOSE 7800
ENTRYPOINT ["/app/pg_tileserv"]
CMD []
# To build and run specific version
#
# export VERSION="latest-alpine-3.17"
# docker build --build-arg VERSION=${VERSION} -t pramsey/pg_tileserv:${VERSION} -f Dockerfile.alpine
#
# Best is to use another PostGIS Docker Container whoose host is reachable from the pg_tileserv Container.
# docker run -dt -e DATABASE_URL=postgres://user:pass@host/dbname -p 7800:7800 pramsey/pg_tileserv:${VERSION}
#
# See a full example using Docker Compose under examples/docker
#