Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: add alpine dockerfile #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Lightweight Alpine-based pg_featureserv Docker Image
# Author: jingsam
FROM golang:1.15.5-alpine3.12

# Build ARGS
ARG VERSION="latest-alpine-3.12"

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.12

ARG VERSION

LABEL original_developer="Crunchy Data" \
contributor="jingsam <[email protected]>" \
vendor="Crunchy Data" \
url="https://crunchydata.com" \
release="${VERSION}" \
org.opencontainers.image.vendor="Crunchy Data" \
os.version="3.12"

RUN apk --no-cache add ca-certificates
COPY --from=0 /app/pg_featureserv .
COPY --from=0 /app/assets ./assets

VOLUME ["/config"]
VOLUME ["/assets"]

USER 1001
EXPOSE 9000

ENTRYPOINT ["/pg_featureserv"]
CMD []

# To build and run specific version
#
# export VERSION="latest-alpine-3.12"
# docker build --build-arg VERSION=${VERSION} -t pramsey/pg_featureserv:${VERSION} -f Dockerfile.alpine
#
# Best is to use another PostGIS Docker Container whoose host is reachable from the pg_featureserv Container.
# docker run -dt -e DATABASE_URL=postgres://user:pass@host/dbname -p 9000:9000 pramsey/pg_featureserv:${VERSION}