Skip to content

Commit

Permalink
- docker file/directory cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sven1977 committed Jan 26, 2018
1 parent a406c81 commit 5b994b9
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 89 deletions.
9 changes: 0 additions & 9 deletions docker/Dockerfile_tensorforce

This file was deleted.

36 changes: 22 additions & 14 deletions docker/ue4_exec_game/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
ARG base_container=base_container
FROM ducandu/ue4_game AS game
RUN echo " "
# to build a final game image that only contains the cooked game executable

ARG base_img=ue4_alien

# the base image to copy from
FROM ducandu/$base_img AS game_img

# new container based on Ubuntu
FROM ubuntu:xenial

ARG game=AlienInvaders

# install minimal python tools to be able to run plugin UnrealEnginePython
RUN apt-get update -y && apt-get install -y --no-install-recommends python3 python3-dev python3-pip python3-setuptools
RUN pip3 install numpy msgpack msgpack-numpy pydevd
Expand All @@ -15,22 +19,26 @@ RUN adduser --disabled-password --home /home/ue4 --shell /bin/bash ue4 && usermo
# change to new user
USER ue4
WORKDIR /home/ue4
RUN mkdir -p Games/AlienInvaders
WORKDIR Games/AlienInvaders

ENV GAME=$game
RUN echo "GAME=${GAME}"

RUN mkdir -p Games
WORKDIR Games

# just copy the cooked game
COPY --from=game --chown=ue4:ue4 /home/ue4/UnrealEngine/AlienInvaders/Build/LinuxNoEditor ./
COPY --from=game_img --chown=ue4:ue4 /home/ue4/UnrealEngine/${GAME}/Build/LinuxNoEditor ./
# and the python scripts
RUN mkdir -p AlienInvaders/Content/Scripts
COPY --from=game --chown=ue4:ue4 /home/ue4/UnrealEngine/AlienInvaders/Content/Scripts AlienInvaders/Content/Scripts/

#USER root
#RUN chmod -R 0777 /home/ue4/Games/AlienInvaders
#USER ue4
COPY --from=game_img --chown=ue4:ue4 /home/ue4/UnrealEngine/${GAME}/Content/Scripts ${GAME}/Content/Scripts/

# TODO: add PYTHONPATH pointing to Games/.../Content/Scripts to env
# add to PYTHONPATH: Games/[the GAME]/Content/Scripts to env
ENV PYTHONPATH=/home/ue4/Games/${GAME}/Content/Scripts

# start the game automatically when running this container
# CMD ["/home/ue4/Games/AlienInvaders/AlienInvaders.sh -NullRHI -nosound"]
CMD ["bash"]
CMD /home/ue4/Games/${GAME}.sh -NullRHI -nosound

# run this container with
# `docker run -d --name aliens ducandu/ue4_[game]_final`
# login to this container via
# `docker exec -ti [container name] bash`
42 changes: 42 additions & 0 deletions docker/ue4_game/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# to build a game on top of either a) the basic (engine) ducandu/ue4 container
# or b) a previously compiled/cooked game

# provide build-args:
# game=[the project's name, e.g. AlienInvaders (default)]
# base_img=[the base image to use: `ue4` for initial build, or `ue4_alien` for an already built game]

ARG base_img=ue4

FROM ducandu/$base_img

USER ue4
WORKDIR /home/ue4

RUN echo " abc"

# default game; override this via `--build-arg game=` on `docker build` command line
ARG base_img=ue4
ENV BASE_IMG=$base_img
ARG game=AlienInvaders
ENV GAME=$game

COPY --chown=ue4:ue4 build_game_init.sh .
COPY --chown=ue4:ue4 build_game_incr.sh .
RUN dos2unix build_game_init.sh
RUN dos2unix build_game_incr.sh
RUN chmod 0777 build_game_init.sh && chmod 0777 build_game_incr.sh
RUN if [ "${BASE_IMG}" = "ue4" ] ; then /bin/sh ./build_game_init.sh ; else /bin/sh ./build_game_incr.sh ; fi

WORKDIR UnrealEngine
## Modify the UnrealEnginePython build cs file to add the python lib and include paths
# not necessary as ubuntu is covered by the default values in UEPython build cs
#RUN sed -i 's/\/usr\/local\/include\/python3.6//' AlienInvaders/Plugins/UnrealEnginePython/Source/UnrealEnginePython/UnrealEnginePython.Build.cs

# - copy necessary scripts from the plugin to the game's content folder
RUN mkdir -p ${GAME}/Content/Scripts/
RUN cp -u ${GAME}/Plugins/MaRLEnE/Scripts/* ${GAME}/Content/Scripts/.

# build and cook the game
RUN Engine/Build/BatchFiles/RunUAT.sh BuildCookRun -project=${GAME}/${GAME}.uproject -nop4 -build -cook -compressed -stage -platform=Linux -clientconfig=Development -pak -archive -archivedirectory="${GAME}/Build" -utf8output

CMD ["bash"]
13 changes: 13 additions & 0 deletions docker/ue4_game/build_game_incr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

cd /home/ue4/marlene
git pull
cd ../UnrealEnginePython
git pull

# copy (update; only newer files) the example game and the two plugins into UnrealEngine
cd
cp -r -u marlene/examples/UE4Games/${GAME} UnrealEngine/.
cp -r -u marlene/Plugins/MaRLEnE UnrealEngine/${GAME}/Plugins/.
cp -r -u UnrealEnginePython UnrealEngine/${GAME}/Plugins/.

15 changes: 15 additions & 0 deletions docker/ue4_game/build_game_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

echo "GAME=$GAME"

mkdir -p UnrealEngine/${GAME}/Plugins

# git all needed repos
# and copy the example game and the two plugins into UnrealEngine
git clone https://github.com/ducandu/marlene.git
cp -r marlene/examples/UE4Games/${GAME} UnrealEngine/.
cp -r marlene/Plugins/MaRLEnE UnrealEngine/${GAME}/Plugins/.

git clone https://github.com/20tab/UnrealEnginePython.git
cp -r UnrealEnginePython UnrealEngine/${GAME}/Plugins/.

30 changes: 0 additions & 30 deletions docker/ue4_incr_game/Dockerfile

This file was deleted.

36 changes: 0 additions & 36 deletions docker/ue4_init_game/Dockerfile

This file was deleted.

0 comments on commit 5b994b9

Please sign in to comment.