mirror of
https://github.com/Luzifer/wiki.git
synced 2024-11-09 15:20:07 +00:00
Add dockerized version
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
65d86049df
commit
1a0b82287a
2 changed files with 53 additions and 0 deletions
47
Dockerfile
Normal file
47
Dockerfile
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
FROM golang:alpine as builder
|
||||||
|
|
||||||
|
ENV GO111MODULE=on
|
||||||
|
|
||||||
|
COPY . /go/src/github.com/Luzifer/wiki
|
||||||
|
WORKDIR /go/src/github.com/Luzifer/wiki
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
&& apk add --update \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
&& go build \
|
||||||
|
-ldflags "-X main.version=$(git describe --tags --always || echo dev)" \
|
||||||
|
-mod=readonly \
|
||||||
|
-o /go/bin/wiki
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
&& curl -sSfLo /usr/local/bin/dumb-init "https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64" \
|
||||||
|
&& curl -sSfLo /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.11/gosu-amd64" \
|
||||||
|
&& chmod +x \
|
||||||
|
/usr/local/bin/dumb-init \
|
||||||
|
/usr/local/bin/gosu
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
ENV DATA_DIR=/data
|
||||||
|
|
||||||
|
LABEL maintainer "Knut Ahlers <knut@ahlers.me>"
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
&& apk --no-cache add \
|
||||||
|
bash \
|
||||||
|
ca-certificates \
|
||||||
|
&& adduser -D -h /home/wiki -S -u 1000 wiki
|
||||||
|
|
||||||
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint
|
||||||
|
COPY --from=builder /go/bin/wiki /usr/local/bin/wiki
|
||||||
|
COPY --from=builder /usr/local/bin/dumb-init /usr/local/bin/dumb-init
|
||||||
|
COPY --from=builder /usr/local/bin/gosu /usr/local/bin/gosu
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
VOLUME ["/data"]
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint"]
|
||||||
|
CMD ["--"]
|
||||||
|
|
||||||
|
# vim: set ft=Dockerfile:
|
6
docker-entrypoint.sh
Executable file
6
docker-entrypoint.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/local/bin/dumb-init /bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
chown wiki: "${DATA_DIR}"
|
||||||
|
|
||||||
|
exec gosu wiki /usr/local/bin/wiki
|
Loading…
Reference in a new issue