2nd version of docker project

This commit is contained in:
stremovsky
2019-12-15 09:27:00 +02:00
parent 83899ca8a9
commit b19486fed5
2 changed files with 24 additions and 9 deletions

View File

@@ -27,17 +27,21 @@ RUN packr
RUN go build -o /go/bin/databunker
# clean packr
RUN packr clean
RUN cp ../run.sh /go/bin/databunker.sh
############################
# STEP 2 build a small image
############################
FROM scratch
# Copy our static executable.
COPY --from=builder /bin/sh /bin/sh
COPY --from=builder /bin/busybox /bin/busybox
COPY --from=builder /bin/busybox /bin/sh
COPY --from=builder /lib/ld* /lib/
COPY --from=builder /go/bin/databunker /go/bin/databunker
COPY --from=builder /go/bin/databunker.sh /go/bin/databunker.sh
COPY --from=builder /go/bin/databunker /databunker/bin/databunker
COPY run.sh /databunker/bin/run.sh
COPY databunker.yaml /databunker/conf/
RUN /bin/busybox mkdir -p /databunker/data
RUN /bin/busybox mkdir -p /databunker/certs
#RUN /bin/busybox ln -s /bin/busybox /bin/sh
# Run the hello binary.
#ENTRYPOINT ["/go/bin/databunker"]
ENTRYPOINT ["/bin/sh", "/go/bin/databunker.sh"]
ENTRYPOINT ["/bin/sh", "/databunker/bin/run.sh"]
#CMD ["/bin/sh", "-x", "-c", "/go/bin/databunker -init"]

19
run.sh
View File

@@ -1,7 +1,18 @@
#!/bin/sh
echo "-------------INIT------------"
/go/bin/databunker -init
ls -al /go/bin/
/bin/busybox find /
DATABUNKER_MASTERKEY=
if [ ! -f /databunker/data/databunker.db ]; then
echo "-------------INIT------------"
/bin/busybox mkdir -p /tmp
RESULT=`/databunker/bin/databunker -init > /tmp/init.txt`
echo $RESULT
ROOT_TOKEN=`/bin/busybox awk '/API Root token:/ {print $4}' /tmp/init.txt`
MASTER_KEY=`/bin/busybox awk '/Master key:/ {print $3}' /tmp/init.txt`
echo "DATABUNKER_ROOTTOKEN $ROOT_TOKEN"
echo "DATABUNKER_MASTERKEY $MASTER_KEY"
/bin/busybox rm -rf /tmp/init.txt
fi
echo "-------------RUN-------------"
/go/bin/databunker
#/go/bin/databunker