-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from Wawszczak/docker-persistent
Allow OpenPlc Configuration storage outside container in Docker Volumes
- Loading branch information
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,22 @@ | ||
FROM debian:bullseye-20211201 | ||
|
||
COPY . /workdir | ||
WORKDIR /workdir | ||
RUN mkdir /persistent | ||
VOLUME /persistent | ||
RUN ./install.sh docker | ||
RUN touch /persistent/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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,28 @@ | ||
#!/bin/bash | ||
if [[ ! -d "/persistent" ]] | ||
then | ||
mkdir /persistent | ||
fi | ||
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 |