-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
118 lines (92 loc) · 5.52 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# =========================== > Base environment < =========================== #
ARG FROM_IMAGE="projects.cispa.saarland:5005/c01sile/containr:latest"
FROM "$FROM_IMAGE"
ARG r_packages="" \
python_packages="" \
ubuntu_packages="" \
vscode_extensions="" \
DROPBEAR_VERSION="2024.85" \
workdir="/WORKDIR/" \
outdir="/OUTDIR/"
ENV \
DEV_CONTAINER_DIR="/dev-container" \
WORKDIR="$workdir" \
OUTDIR="$outdir" \
DEBIAN_FRONTEND="noninteractive"
ONBUILD ARG \
r_packages="" \
python_packages="" \
ubuntu_packages="" \
vscode_extensions="" \
workdir="/WORKDIR/" \
outdir="/OUTDIR/"
ONBUILD ENV \
WORKDIR="$workdir" \
OUTDIR="$outdir" \
DEBIAN_FRONTEND="noninteractive"
SHELL ["/bin/bash", "-c"]
# ────────────────────────────────── <end> ─────────────────────────────────── #
# ============================ > Copy ./scripts < ============================ #
COPY scripts/run /$DEV_CONTAINER_DIR/run
COPY scripts/build /$DEV_CONTAINER_DIR/build
# ────────────────────────────────── <end> ─────────────────────────────────── #
# ========================== > Run Build scripts < =========================== #
# ========================= > Install dependencies < ========================= #
# =========================== > Ubuntu packages < ============================ #
RUN \
if [ -n "${ubuntu_packages}" ]; then \
/$DEV_CONTAINER_DIR/build/install_ubuntu_pkgs "${ubuntu_packages}" || exit $?; \
fi;
ONBUILD RUN \
if [ -n "${ubuntu_packages}" ]; then \
/$DEV_CONTAINER_DIR/build/install_ubuntu_pkgs "${ubuntu_packages}" || exit $?; \
fi;
# ────────────────────────────────── <end> ─────────────────────────────────── #
# ============================== > R packages < ============================== #
RUN \
if [ -n "${r_packages}" ]; then \
/$DEV_CONTAINER_DIR/build/install_R_pkgs "${r_packages}" || exit $?; \
fi;
ONBUILD RUN \
if [ -n "${r_packages}" ]; then \
/$DEV_CONTAINER_DIR/build/install_R_pkgs "${r_packages}" || exit $?; \
fi;
# ────────────────────────────────── <end> ─────────────────────────────────── #
# =========================== > Python packages < ============================ #
RUN \
if [ -n "${python_packages}" ]; then \
/$DEV_CONTAINER_DIR/build/install_python_pkgs "${python_packages}" || exit $?; \
fi;
ONBUILD RUN \
if [ -n "${python_packages}" ]; then \
/$DEV_CONTAINER_DIR/build/install_python_pkgs "${python_packages}" || exit $?; \
fi;
# ────────────────────────────────── <end> ─────────────────────────────────── #
# ────────────────────────────────── <end> ─────────────────────────────────── #
# ======================== > Install vscode-server < ========================= #
RUN \
/$DEV_CONTAINER_DIR/build/install_vscode-server "linux" "x64"
RUN \
export PATH="/root/.vscode-server/bin/default_version/bin:$PATH"; \
if [ -n "${vscode_extensions}" ]; then \
/$DEV_CONTAINER_DIR/build/install_vscode-extensions "${vscode_extensions}" || exit $?; \
fi;
ONBUILD RUN \
export PATH="/root/.vscode-server/bin/default_version/bin:$PATH"; \
if [ -n "${vscode_extensions}" ]; then \
/$DEV_CONTAINER_DIR/build/install_vscode-extensions "${vscode_extensions}" || exit $?; \
fi;
# ────────────────────────────────── <end> ─────────────────────────────────── #
# ────────────────────────────────── <end> ─────────────────────────────────── #
# ===================== > Install dropbear SSH server < ====================== #
RUN /$DEV_CONTAINER_DIR/build/install_dropbear "${DROPBEAR_VERSION}";
# ────────────────────────────────── <end> ─────────────────────────────────── #
# =============================== > SSH keys < =============================== #
COPY scripts/ssh_keys/* /$DEV_CONTAINER_DIR/ssh_keys/
COPY scripts/ssh_keys/* /$DEV_CONTAINER_DIR/run/.default_ssh_keys/
# ────────────────────────────────── <end> ─────────────────────────────────── #
RUN \
chmod a+x "${DEV_CONTAINER_DIR}/run/dropbear_init"; \
ln -s "${DEV_CONTAINER_DIR}/run/ssh_entrypoint" /.ssh_entrypoint; \
ln -s "${DEV_CONTAINER_DIR}/run/dropbear_init" /dropbear_init;
CMD bash -c "/dropbear_init"