summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Óscar García Amor2022-12-14 11:46:16 +0100
committerGravatar Óscar García Amor2022-12-14 11:46:16 +0100
commit89f6924ae2493b5670bbd24a2db1bde69a3118a6 (patch)
treee58795ab32ccf5f6f904b8a305ec36560ba9a08f
parentVersion 2.15 RELEASED. (diff)
downloadsnac2-89f6924ae2493b5670bbd24a2db1bde69a3118a6.tar.gz
snac2-89f6924ae2493b5670bbd24a2db1bde69a3118a6.tar.xz
snac2-89f6924ae2493b5670bbd24a2db1bde69a3118a6.zip
Improve Docker image generation
-rw-r--r--Dockerfile26
-rwxr-xr-xexamples/docker-entrypoint.sh7
2 files changed, 19 insertions, 14 deletions
diff --git a/Dockerfile b/Dockerfile
index 05ae1fe..e909cfa 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,12 +1,16 @@
1FROM alpine 1ARG ALPINE_VERSION=latest
2ENV LANG C.UTF-8 2
3ENV LC_ALL C.UTF-8 3FROM alpine:${ALPINE_VERSION} AS builder
4RUN apk add --no-cache curl-dev build-base
5COPY . /build 4COPY . /build
6WORKDIR /build 5RUN apk -U --no-progress --no-cache add curl-dev build-base && \
7RUN make 6 cd /build && make && \
8COPY examples/docker-entrypoint.sh /usr/local/bin/entrypoint.sh 7 make PREFIX="/build/out/usr/local" PREFIX_MAN="/build/out/usr/local/share/man" install && \
9RUN chmod +x /usr/local/bin/entrypoint.sh 8 chmod +x examples/docker-entrypoint.sh && \
10ENTRYPOINT ["/bin/sh", "/usr/local/bin/entrypoint.sh"] 9 cp examples/docker-entrypoint.sh /build/out/usr/local/bin/entrypoint.sh
11EXPOSE 8001 10
12CMD /build/snac 11FROM alpine:${ALPINE_VERSION}
12RUN apk -U --no-progress --no-cache add libcurl
13COPY --from=builder /build/out /
14EXPOSE 5050
15VOLUME [ "/data" ]
16ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
diff --git a/examples/docker-entrypoint.sh b/examples/docker-entrypoint.sh
index b64e039..639b692 100755
--- a/examples/docker-entrypoint.sh
+++ b/examples/docker-entrypoint.sh
@@ -1,6 +1,7 @@
1#! /bin/sh
1if [ ! -e /data/data/server.json ] 2if [ ! -e /data/data/server.json ]
2then 3then
3 echo -ne "0.0.0.0\r\n8001\r\nlocalhost\r\n\r\n" | /build/snac init /data/data 4 echo -ne "0.0.0.0\r\n8001\r\nlocalhost\r\n\r\n" | snac init /data/data
4 /build/snac adduser /data/data testuser 5 snac adduser /data/data testuser
5fi 6fi
6SSLKEYLOGFILE=/data/key /build/snac httpd /data/data 7SSLKEYLOGFILE=/data/key snac httpd /data/data