-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
95 lines (73 loc) · 4.03 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# A minimal, but uptodate arch linux
FROM archlinux AS updated-archlinux
COPY files/etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist
RUN pacman -Sy --noconfirm archlinux-keyring pacman-mirrorlist && pacman-key --init && \
pacman -Syy --noconfirm archlinux-keyring pacman-mirrorlist && \
pacman -Syyu --noconfirm && \
rm -R /var/cache/pacman/pkg/* /var/lib/pacman/sync/*
# A minimal clone of the webots repository (this is mainly to generate smaller image sizes)
FROM alpine/git AS minimal-webots-clone
RUN git clone -b archlinux https://github.com/SGSSGene/webots.git --depth 1 --recursive /code/webots
RUN (cd /code/webots && git pull)
# compiling webots
FROM updated-archlinux AS webots-build
ARG MAKEFLAGS
COPY --from=minimal-webots-clone /code /code
RUN pacman -Syu --noconfirm lsb-release cmake zsh swig freeimage boost zziplib zip pbzip2 wget unzip \
xorg-server-xvfb which glu nss libxcomposite libxrandr libxcursor ttf-dejavu \
libxi libxtst libxkbcommon alsa-lib libpulse libssh libzip glm qt5-base \
gcc make libjpeg-turbo protobuf-c protobuf python jdk-openjdk && \
rm -R /var/cache/pacman/pkg/* /var/lib/pacman/sync/*
RUN echo "Building webots and the player controller" && \
export WEBOTS_HOME=/code/webots && \
export JAVA_HOME=/usr/lib/jvm/java-18-openjdk && \
export PATH=/usr/lib/jvm/java-18-openjdk/bin:${PATH} && \
cd /code/webots && \
\
make && \
(cd projects/samples/contests/robocup/ && make)
RUN cd /code/webots && \
find . -name "*.d" -or -name "*.o" -delete && \
rm -rf .git docs projects/vehicles projects/robots/[^r]* projects/objects/buildings projects/objects/street_furniture projects/objects/road && \
chmod o+rwX -R /code
# A minimal clone of the GameController repository (this is mainly to do the same as with webots
FROM alpine/git AS minimal-GameController-clone
RUN git clone -b master https://github.com/RoboCup-Humanoid-TC/GameController.git --depth 1 --recursive /code/GameController
# compiling GameController
FROM updated-archlinux AS GameController-build
COPY --from=minimal-GameController-clone /code /code
RUN pacman -Syu --noconfirm protobuf ant && \
rm -R /var/cache/pacman/pkg/* /var/lib/pacman/sync/* && \
echo "Building the GameController" && \
cd /code/GameController && \
export JAVA_HOME=/usr/lib/jvm/java-18-openjdk && \
export PATH=/usr/lib/jvm/java-18-openjdk/bin:${PATH} && \
ant && \
chmod o+rwX -R /code
FROM updated-archlinux
COPY --from=webots-build --chown=1000:1000 /code/webots /code/webots
COPY --from=GameController-build --chown=1000:1000 /code/GameController /code/GameController
RUN pacman -Syu --noconfirm freeimage boost zziplib \
glu libxcomposite libxrandr libxcursor ttf-dejavu \
libxi libxtst libxkbcommon alsa-lib libpulse libssh libzip glm qt5-base \
libjpeg-turbo protobuf-c \
python python-pip nvidia-prime xorg-server-xvfb \
ant pandoc texlive-core && \
rm -R /var/cache/pacman/pkg/* /var/lib/pacman/sync/* && \
pip3 install -r /code/webots/projects/samples/contests/robocup/controllers/referee/requirements.txt && \
pip3 install -r /code/webots/projects/samples/contests/robocup/controllers/model_verifier/requirements.txt && \
pip3 cache purge && \
\
echo "set access rights and add user" && \
useradd webots -m && \
mkdir /robocup && chown webots:webots /robocup
#TODO how should the entry point look like?
COPY files/usr/bin/webots-run /usr/bin/webots-run
COPY files/usr/bin/GameController.sh /usr/bin/GameController.sh
COPY files/etc/robocup /etc/robocup
COPY files/robocup_balls.wbt /code/webots/projects/samples/contests/robocup/worlds/robocup_balls.wbt
COPY files/referee.py /code/webots/projects/samples/contests/robocup/controllers/referee/referee.py
COPY --chown=webots:webots files/webots/ /home/webots
USER webots
WORKDIR /code/webots
CMD webots-run "--help"