mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2024-11-10 20:57:23 +01:00
Added dynamic creation of map only if needed
This commit is contained in:
parent
3cd89b6870
commit
e30bf8d656
@ -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