forked from KSP-CKAN/CKAN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (61 loc) · 1.64 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
# Dockerfile for the Comprehensive Kerbal Archive Network (CKAN) client
#
#
# You do not need to use Docker to build, run, or test the CKAN, but you
# can if you like! :)
#
#
# To build the container:
# $ docker build -t ckan .
#
# To use the container to update all mods:
# $ docker run --rm -v ${KSPDIR}:/kspdir ckan
#
# To use the container to install MechJeb:
# $ docker run --rm -v ${KSPDIR}:/kspdir ckan install MechJeb
#
# Both of the last two lines require that the ${KSPDIR} value be set.
#
# There is a docker-compose.yml supplied which will automatically do this for Linux users.
#
# To use the YAML file to build the container:
# $ docker-compose build ckan
#
# To use the YAML file to update all mods:
# $ docker-compose run --rm ckan
#
# To use the YAML file to install MechJeb
# $ docker-compose run --rm ckan install MechJeb
FROM mono
RUN echo '#!/bin/bash\n\
chown --reference=/kspdir/GameData -R /kspdir\n\
' >> /root/cleanup.sh
RUN chmod +x /root/cleanup.sh
RUN echo 'trap /root/cleanup.sh EXIT\n\
ckan()\n\
{\n\
mono /build/ckan.exe "$@" --kspdir /kspdir --headless\n\
}\n\
ckan update\n\
' >> /root/.bashrc
RUN echo '#!/bin/bash\n\
source /root/.bashrc\n\
ckan scan\n\
if [ "$#" -ne 0 ]; then\n\
ckan $@\n\
else\n\
ckan upgrade --all\n\
fi\n\
' >> /root/entrypoint.sh
RUN chmod +x /root/entrypoint.sh
RUN apt-get -y update && apt-get -y install libcurl4-openssl-dev
RUN mkdir /kspdir
VOLUME ["/kspdir"]
COPY . /source
WORKDIR /source
ARG config
ENV config ${config:-Release}
RUN ./build --configuration=${config}
RUN mkdir /build
RUN cp _build/repack/${config}/ckan.exe /build/ckan.exe
ENTRYPOINT ["/root/entrypoint.sh"]