-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
78 lines (72 loc) · 2.34 KB
/
Dockerfile
File metadata and controls
78 lines (72 loc) · 2.34 KB
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
# syntax=docker/dockerfile:1.7
FROM mcr.microsoft.com/powershell:debian-12
# ----------------------------
# Runtime paths (mounted + immutable)
# ----------------------------
ENV CONFIG_DIR=/config \
OVERLAY_DIR=/config/Overlay \
SERVER_DIR=/config/Server \
SERVER_ROOT=/config/Merged \
WORK_DIR=/config/.overlay-work \
HOME_DIR=/home/lancommander \
BASE_MODULES=/usr/local/share/powershell/Modules \
BASE_HOOKS=/usr/local/share/powershell/Hooks \
USER_MODULES=/config/Scripts/Modules \
USER_HOOKS=/config/Scripts/Hooks \
START_EXE="" \
START_ARGS="" \
HTTP_FILESERVER_ENABLED="" \
HTTP_FILESERVER_ROOT=/config/Merged \
HTTP_FILESERVER_FILE_PATTERN="" \
UID=1000 \
GID=1000 \
USER=lancommander \
GROUP=lancommander \
PATH="$PATH:/config/Merged"
# ----------------------------
# User + directories
# ----------------------------
RUN apt-get update && apt-get install -y --no-install-recommends \
nginx \
gosu \
&& rm -rf /var/lib/apt/lists/* \
&& useradd -m -u ${UID} -d "${HOME_DIR}" -s /usr/sbin/nologin ${USER} \
&& mkdir -p \
"${HOME_DIR}" \
"${CONFIG_DIR}" \
"${OVERLAY_DIR}" \
"${SERVER_DIR}" \
"${WORK_DIR}" \
"${SERVER_ROOT}" \
"${BASE_MODULES}" \
"${BASE_HOOKS}" \
&& chown -R ${USER}:${GROUP} \
"${HOME_DIR}" \
"${CONFIG_DIR}" \
"${OVERLAY_DIR}" \
"${SERVER_DIR}"
# ----------------------------
# Built-in (immutable) PowerShell modules shipped with this image
# - BASE_MODULES: modules PowerShell should load from the image
#
# NOTE:
# Do NOT bake modules into /config at build time. /config is typically a volume and
# will hide anything placed there in the image.
# ----------------------------
COPY Modules/ "${BASE_MODULES}/"
# COPY Hooks/ "${BASE_HOOKS}/" # (No built-in hooks for now)
# ----------------------------
# Entrypoint
# ----------------------------
COPY ./Entrypoint.ps1 /usr/local/bin/entrypoint.ps1
RUN chmod +x /usr/local/bin/entrypoint.ps1
# ----------------------------
# Nginx configuration template
# ----------------------------
RUN mkdir -p /usr/local/share
COPY ./nginx.conf /usr/local/share/nginx.conf.template
# ----------------------------
# Runtime
# ----------------------------
WORKDIR /config
ENTRYPOINT ["/usr/local/bin/entrypoint.ps1"]