added first start logic to seed db and keep state

This commit is contained in:
Kai Kriegel 2021-11-24 20:35:54 +00:00
parent 76a1def456
commit ab3ac8f730
2 changed files with 12 additions and 1 deletions

View File

@ -15,10 +15,11 @@ FROM debian:buster-slim
RUN apt-get update && apt-get upgrade -yqq
RUN apt-get install -yqq libgsasl7 && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/diflouroborane /usr/local/bin/diflouroborane
COPY ./docker/startup.sh /startup.sh
#COPY --from=builder /usr/src/bffh/examples/bffh.dhall /etc/diflouroborane.dhall
# RUN diflouroborane --print-default > /etc/diflouroborane.toml
VOLUME /etc/bffh/
VOLUME /var/lib/bffh/
VOLUME /usr/local/lib/bffh/adapters/
EXPOSE 59661
ENTRYPOINT ["sh", "-c", "diflouroborane -c /etc/bffh/bffh.dhall --load=/etc/bffh; diflouroborane -c /etc/bffh/bffh.dhall"]
ENTRYPOINT ["/bin/bash", "/startup.sh"]

10
docker/startup.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
CONTAINER_ALREADY_STARTED="/var/lib/bffh/firststartflag"
if [ ! -e $CONTAINER_ALREADY_STARTED ]; then
touch $CONTAINER_ALREADY_STARTED
echo "-- Seeding Database --"
diflouroborane -c /etc/bffh/bffh.dhall --load=/etc/bffh
else
diflouroborane -c /etc/bffh/bffh.dhall
fi