-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
89 lines (79 loc) · 2.63 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
#Build
ARG fedora_version=33
FROM fedora:${fedora_version} as build-env
RUN sudo dnf update --assumeyes --verbose && dnf install --assumeyes --verbose \
Box2D.x86_64 \
Box2D-devel.x86_64 \
compat-openssl10 \
openssl \
poco-devel \
poco-foundation \
protobuf \
protobuf-devel \
gcc \
g++ \
cmake \
git \
qpid-proton-cpp \
qpid-proton-cpp-devel \
yaml-cpp-devel \
&& dnf clean all \
&& rm -rf /var/cache/yum
COPY CMakeLists.txt /tmp/srt-game-server/
#COPY config.yaml /tmp/srt-game-server/
COPY src/ /tmp/srt-game-server/src/
WORKDIR /tmp/srt-game-server/src/Proto
RUN for i in `ls -lC1 *.proto`; do `echo protoc $i --cpp_out=.`; done; mkdir /tmp/build
WORKDIR /tmp/build
RUN echo `pwd`; \
ls -lR /tmp/srt-game-server; \
echo "Running cmake /tmp/srt-game-server\n"; \
cmake /tmp/srt-game-server
RUN echo "Running cmake --build .\n"; \
cmake --build . --parallel -j $(($(grep -c ^processor /proc/cpuinfo)+1))
# Run
FROM fedora:${fedora_version} as base-env
COPY containerbuild/srt.repo /etc/yum.repos.d/
RUN sudo dnf update --assumeyes --verbose && dnf install --assumeyes --verbose \
Box2D.x86_64 \
Box2D-devel.x86_64 \
compat-openssl10 \
openssl \
poco-devel \
poco-foundation \
protobuf \
protobuf-devel \
qpid-proton-cpp \
qpid-proton-cpp-devel \
yaml-cpp \
&& dnf clean all \
&& rm -rf /var/cache/yum
ENV USER_UID=1000
ENV USER_NAME=srt-game-server
ENV EXECUTABLE_NAME=srt-game-server.bin
ENV EXECUTABLE=/home/${USER_NAME}/bin/${EXECUTABLE_NAME}
ENV BROKER_URI=tcp://artemiscloud:5672
ENV LOG_LEVEL=1
ENV SLEEP_CYCLE=1400
WORKDIR /
RUN mkdir -p /home/${USER_NAME}/bin
RUN mkdir -p /home/${USER_NAME}/etc
#COPY bin/${EXECUTABLE_NAME} /home/${USER_NAME}/bin
COPY --from=build-env /tmp/build/srt-game-server /home/${USER_NAME}/bin/${EXECUTABLE_NAME}
#COPY config.yaml /home/${USER_NAME}/etc
COPY containerbuild/bin/entrypoint /home/${USER_NAME}/bin
RUN chown -R `id -u`:0 /home/${USER_NAME}/bin && chmod -R 755 /home/${USER_NAME}/bin
RUN chown -R `id -u`:0 /home/${USER_NAME}/etc && chmod -R 755 /home/${USER_NAME}/etc
USER ${USER_UID}:0
WORKDIR /home/${USER_NAME}/bin
ENTRYPOINT /home/${USER_NAME}/bin/entrypoint --broker-uri ${BROKER_URI} --sleep-cycle ${SLEEP_CYCLE}
CMD [-v, ${LOG_LEVEL}]
LABEL \
com.srt.component="srt-game-server" \
description="Space Ring Things game physics server" \
io.k8s.description="Main game simulation container for Space Ring Things" \
io.k8s.display-name="Space Ring Things 0.4" \
maintainer="Roddie Kieley <[email protected]>" \
name="roddiekieley/srt-game-server" \
summary="Space Ring Things game physics server" \
version="0.4"