diff options
author | Óscar García Amor <ogarcia@connectical.com> | 2022-12-14 11:46:16 +0100 |
---|---|---|
committer | Óscar García Amor <ogarcia@connectical.com> | 2022-12-14 11:46:16 +0100 |
commit | 89f6924ae2493b5670bbd24a2db1bde69a3118a6 (patch) | |
tree | e58795ab32ccf5f6f904b8a305ec36560ba9a08f | |
parent | 953d109f10d7ae837e1dbd8769ac2dda94b45140 (diff) |
Improve Docker image generation
-rw-r--r-- | Dockerfile | 26 | ||||
-rwxr-xr-x | examples/docker-entrypoint.sh | 7 |
2 files changed, 19 insertions, 14 deletions
@@ -1,12 +1,16 @@ -FROM alpine -ENV LANG C.UTF-8 -ENV LC_ALL C.UTF-8 -RUN apk add --no-cache curl-dev build-base +ARG ALPINE_VERSION=latest + +FROM alpine:${ALPINE_VERSION} AS builder COPY . /build -WORKDIR /build -RUN make -COPY examples/docker-entrypoint.sh /usr/local/bin/entrypoint.sh -RUN chmod +x /usr/local/bin/entrypoint.sh -ENTRYPOINT ["/bin/sh", "/usr/local/bin/entrypoint.sh"] -EXPOSE 8001 -CMD /build/snac +RUN apk -U --no-progress --no-cache add curl-dev build-base && \ + cd /build && make && \ + make PREFIX="/build/out/usr/local" PREFIX_MAN="/build/out/usr/local/share/man" install && \ + chmod +x examples/docker-entrypoint.sh && \ + cp examples/docker-entrypoint.sh /build/out/usr/local/bin/entrypoint.sh + +FROM alpine:${ALPINE_VERSION} +RUN apk -U --no-progress --no-cache add libcurl +COPY --from=builder /build/out / +EXPOSE 5050 +VOLUME [ "/data" ] +ENTRYPOINT [ "/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 @@ +#! /bin/sh if [ ! -e /data/data/server.json ] then - echo -ne "0.0.0.0\r\n8001\r\nlocalhost\r\n\r\n" | /build/snac init /data/data - /build/snac adduser /data/data testuser + echo -ne "0.0.0.0\r\n8001\r\nlocalhost\r\n\r\n" | snac init /data/data + snac adduser /data/data testuser fi -SSLKEYLOGFILE=/data/key /build/snac httpd /data/data +SSLKEYLOGFILE=/data/key snac httpd /data/data |