Skip to content

Commit

Permalink
add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
T committed Jan 31, 2019
1 parent 0c87c66 commit cf5feae
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ubuntu:18.04

RUN apt-get update && apt-get install -y build-essential pkg-config bison flex autoconf automake libtool make git python2.7 python-pip sqlite3 cmake git
RUN pip install flask flask-login pyserial
COPY . /workdir
RUN cd /workdir && ./install.sh docker
WORKDIR /workdir
ENTRYPOINT ["./start_openplc.sh"]
82 changes: 82 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,88 @@ WantedBy=multi-user.target" >> openplc.service
cp ./start_openplc.sh ../../


elif [ "$1" == "docker" ]; then
echo "Installing OpenPLC on Linux inside Docker"

echo ""
echo "[MATIEC COMPILER]"
cd utils/matiec_src
autoreconf -i
./configure
make
cp ./iec2c ../../webserver/
if [ $? -ne 0 ]; then
echo "Error compiling MatIEC"
echo "OpenPLC was NOT installed!"
exit 1
fi
cd ../..

echo ""
echo "[ST OPTIMIZER]"
cd utils/st_optimizer_src
g++ st_optimizer.cpp -o st_optimizer
cp ./st_optimizer ../../webserver/
if [ $? -ne 0 ]; then
echo "Error compiling ST Optimizer"
echo "OpenPLC was NOT installed!"
exit 1
fi
cd ../..

echo ""
echo "[GLUE GENERATOR]"
cd utils/glue_generator_src
g++ glue_generator.cpp -o glue_generator
cp ./glue_generator ../../webserver/core
if [ $? -ne 0 ]; then
echo "Error compiling Glue Generator"
echo "OpenPLC was NOT installed!"
exit 1
fi
cd ../..

echo ""
echo "[OPEN DNP3]"
cd utils/dnp3_src
echo "creating swapfile..."
dd if=/dev/zero of=swapfile bs=1M count=1000
mkswap swapfile
swapon swapfile
cmake ../dnp3_src
make
make install
if [ $? -ne 0 ]; then
echo "Error installing OpenDNP3"
echo "OpenPLC was NOT installed!"
exit 1
fi
ldconfig
echo "removing swapfile..."
swapoff swapfile
rm -f ./swapfile
cd ../..

echo ""
echo "[LIBMODBUS]"
cd utils/libmodbus_src
./autogen.sh
./configure
make install
if [ $? -ne 0 ]; then
echo "Error installing Libmodbus"
echo "OpenPLC was NOT installed!"
exit 1
fi
ldconfig
cd ../..

echo ""
echo "[FINALIZING]"
cd webserver/scripts
./change_hardware_layer.sh blank_linux
./compile_program.sh blank_program.st
cp ./start_openplc.sh ../../

elif [ "$1" == "rpi" ]; then
echo "Installing OpenPLC on Raspberry Pi"
Expand Down

0 comments on commit cf5feae

Please sign in to comment.