mirror of
https://github.com/bplein/factorio-docker.git
synced 2024-11-24 08:42:31 +02:00
Added dynamic creation of map only if needed
This commit is contained in:
parent
43af3aaf33
commit
6f33dd8444
@ -6,13 +6,13 @@ WORKDIR /opt
|
||||
|
||||
COPY ./factorio.tar.gz /opt
|
||||
|
||||
RUN tar -xzf factorio.tar.gz
|
||||
COPY ./smart_launch.sh /opt
|
||||
|
||||
RUN ["/opt/factorio/bin/x64/factorio", "--create", "save.zip"]
|
||||
RUN tar -xzf factorio.tar.gz
|
||||
|
||||
WORKDIR /opt/factorio
|
||||
|
||||
CMD ["/opt/factorio/bin/x64/factorio", "--disallow-commands", "--start-server", "save.zip"]
|
||||
CMD ["./smart_launch.sh"]
|
||||
|
||||
EXPOSE 34197/udp
|
||||
|
||||
|
21
smart_launch.sh
Executable file
21
smart_launch.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -f /opt/factorio/saves/save.zip ]
|
||||
then
|
||||
echo "###"
|
||||
echo "# Using existing map [save.zip]"
|
||||
echo "###"
|
||||
else
|
||||
echo "###"
|
||||
echo "# Creating a new map [save.zip]"
|
||||
echo "###"
|
||||
opt/factorio/bin/x64/factorio --create save.zip
|
||||
echo "###"
|
||||
echo "# New map created [save.zip]"
|
||||
echo "###"
|
||||
fi
|
||||
|
||||
echo "###"
|
||||
echo "# Launching Game"
|
||||
echo "###"
|
||||
exec /opt/factorio/bin/x64/factorio --disallow-commands --start-server save.zip
|
Loading…
Reference in New Issue
Block a user