commit 89f6924
Óscar García Amor
·
2022-12-14 10:46:16 +0000 UTC
parent 953d109
Improve Docker image generation
2 files changed,
+19,
-14
+15,
-11
1@@ -1,12 +1,16 @@
2-FROM alpine
3-ENV LANG C.UTF-8
4-ENV LC_ALL C.UTF-8
5-RUN apk add --no-cache curl-dev build-base
6+ARG ALPINE_VERSION=latest
7+
8+FROM alpine:${ALPINE_VERSION} AS builder
9 COPY . /build
10-WORKDIR /build
11-RUN make
12-COPY examples/docker-entrypoint.sh /usr/local/bin/entrypoint.sh
13-RUN chmod +x /usr/local/bin/entrypoint.sh
14-ENTRYPOINT ["/bin/sh", "/usr/local/bin/entrypoint.sh"]
15-EXPOSE 8001
16-CMD /build/snac
17+RUN apk -U --no-progress --no-cache add curl-dev build-base && \
18+ cd /build && make && \
19+ make PREFIX="/build/out/usr/local" PREFIX_MAN="/build/out/usr/local/share/man" install && \
20+ chmod +x examples/docker-entrypoint.sh && \
21+ cp examples/docker-entrypoint.sh /build/out/usr/local/bin/entrypoint.sh
22+
23+FROM alpine:${ALPINE_VERSION}
24+RUN apk -U --no-progress --no-cache add libcurl
25+COPY --from=builder /build/out /
26+EXPOSE 5050
27+VOLUME [ "/data" ]
28+ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
+4,
-3
1@@ -1,6 +1,7 @@
2+#! /bin/sh
3 if [ ! -e /data/data/server.json ]
4 then
5- echo -ne "0.0.0.0\r\n8001\r\nlocalhost\r\n\r\n" | /build/snac init /data/data
6- /build/snac adduser /data/data testuser
7+ echo -ne "0.0.0.0\r\n8001\r\nlocalhost\r\n\r\n" | snac init /data/data
8+ snac adduser /data/data testuser
9 fi
10-SSLKEYLOGFILE=/data/key /build/snac httpd /data/data
11+SSLKEYLOGFILE=/data/key snac httpd /data/data