Skip to content

Commit

Permalink
Add dockerized version
Browse files Browse the repository at this point in the history
Signed-off-by: Knut Ahlers <knut@ahlers.me>
  • Loading branch information
Luzifer committed Jan 28, 2018
1 parent bfa3bd1 commit daa85d5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM golang:alpine

LABEL maintainer "Knut Ahlers <knut@ahlers.me>"

ADD . /go/src/github.com/Luzifer/nginx-sso
WORKDIR /go/src/github.com/Luzifer/nginx-sso

RUN set -ex \
&& apk --no-cache add git ca-certificates bash curl \
&& go install -ldflags "-X main.version=$(git describe --tags || git rev-parse --short HEAD || echo dev)" \
&& curl -sSfLo /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 \
&& chmod +x /usr/local/bin/dumb-init \
&& apk --no-cache del --purge git curl

EXPOSE 8082

VOLUME ["/data"]

ADD docker-start.sh /usr/local/bin

ENTRYPOINT ["/usr/local/bin/docker-start.sh"]
CMD ["--"]
17 changes: 17 additions & 0 deletions docker-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/local/bin/dumb-init /bin/bash
set -euo pipefail

# Copy frontend if not available
[ -d /data/frontend ] || cp -r /go/src/github.com/Luzifer/nginx-sso/frontend /data/frontend

[ -e /data/config.yaml ] || {
cp /go/src/github.com/Luzifer/nginx-sso/config.yaml /data/config.yaml
echo "An example configuration was copied to /data/config.yaml - You want to edit that one!"
exit 1
}

echo "Starting nginx-sso"
exec /go/bin/nginx-sso \
--config /data/config.yaml \
--frontend-dir /data/frontend \
$@

0 comments on commit daa85d5

Please sign in to comment.