mirror of
https://github.com/thiagoralves/OpenPLC_v3.git
synced 2026-02-06 02:02:20 +08:00
adding persistence in Docker volume feature
symlinks for: openplc.db persistent.file mbconfig.cfg dnp3.cfg st_files /persistent -> /workdir/webserver paths are hardcoded in scripts/start_openplc.sh
This commit is contained in:
13
Dockerfile
13
Dockerfile
@@ -5,7 +5,18 @@ RUN mkdir /persistent
|
||||
VOLUME /persistent
|
||||
RUN ./install.sh docker
|
||||
RUN touch /persistent/mbconfig.cfg
|
||||
RUN ln -s /persistent/mbconfig.cfg /workdir/webserver/mbconfig.cfg
|
||||
RUN touch /persistent/persistent.file
|
||||
RUN mkdir /persistent/st_files
|
||||
RUN cp /workdir/webserver/openplc.db /persistent/openplc.db
|
||||
RUN mv /workdir/webserver/openplc.db /workdir/webserver/openplc_default.db
|
||||
RUN cp /workdir/webserver/dnp3.cfg /persistent/dnp3.cfg
|
||||
RUN mv /workdir/webserver/dnp3.cfg /workdir/webserver/dnp3_default.cfg
|
||||
RUN cp /workdir/webserver/st_files/* /persistent/st_files
|
||||
run mv /workdir/webserver/st_files /workdir/webserver/st_files_default
|
||||
RUN ln -s /persistent/mbconfig.cfg /workdir/webserver/mbconfig.cfg
|
||||
RUN ln -s /persistent/persistent.file /workdir/webserver/persistent.file
|
||||
RUN ln -s /persistent/openplc.db /workdir/webserver/openplc.db
|
||||
RUN ln -s /persistent/dnp3.cfg /workdir/webserver/dnp3.cfg
|
||||
RUN ln -s /persistent/st_files /workdir/webserver/st_files
|
||||
|
||||
ENTRYPOINT ["./start_openplc.sh"]
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
#!/bin/bash
|
||||
if [[ ! -f "/persistent/dnp3.cfg" ]]
|
||||
then
|
||||
cp /workdir/webserver/dnp3_default.cfg /persistent/dnp3.cfg
|
||||
fi
|
||||
if [[ ! -f "/persistent/openplc.db" ]]
|
||||
then
|
||||
cp /workdir/webserver/openplc_default.db /persistent/openplc.db
|
||||
fi
|
||||
if [[ ! -d "/persistent/st_files" ]]
|
||||
then
|
||||
mkdir /persistent/st_files
|
||||
cp /workdir/webserver/st_files_default/* /persistent/st_files
|
||||
fi
|
||||
if [[ ! -f "/persistent/persistent.file" ]]
|
||||
then
|
||||
touch /persistent/persistent.file
|
||||
fi
|
||||
if [[ ! -f "/persistent/mbconfig.cfg" ]]
|
||||
then
|
||||
touch /persistent/mbconfig.cfg
|
||||
fi
|
||||
cd webserver
|
||||
python2.7 webserver.py
|
||||
|
||||
Reference in New Issue
Block a user