-
Notifications
You must be signed in to change notification settings - Fork 9
/
alpine.dockerfile
72 lines (64 loc) · 2.38 KB
/
alpine.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
# Use a minimal base image
FROM alpine:edge
# Build arguments to set environment variables at build time
ARG DEF_VNC_SCREEN=0
ARG DEF_VNC_DISPLAY=0
ARG DEF_VNC_RESOLUTION=1280x720
ARG DEF_VNC_PASSWORD=money4band
ARG DEF_VNC_PORT=5900
ARG DEF_NOVNC_WEBSOCKIFY_PORT=6080
ARG DEF_STARTING_WEBSITE_URL=https://www.google.com
ARG DEF_LANG=en_US.UTF-8
ARG DEF_LC_ALL=C.UTF-8
ARG DEF_CUSTOMIZE=false
ARG DEF_CUSTOM_ENTRYPOINTS_DIR=/app/custom_entrypoints_scripts
ARG DEF_AUTO_START_BROWSER=true
ARG DEF_AUTO_START_XTERM=true
# Set environment variables with default values
ENV DISPLAY=:${DEF_VNC_DISPLAY}.${DEF_VNC_SCREEN} \
VNC_SCREEN=${DEF_VNC_SCREEN} \
VNC_DISPLAY=${DEF_VNC_DISPLAY} \
VNC_RESOLUTION=${DEF_VNC_RESOLUTION} \
VNC_PASSWORD=${DEF_VNC_PASSWORD} \
VNC_PORT=${DEF_VNC_PORT} \
NOVNC_WEBSOCKIFY_PORT=${DEF_NOVNC_WEBSOCKIFY_PORT} \
STARTING_WEBSITE_URL=${DEF_STARTING_WEBSITE_URL} \
LANG=${DEF_LANG} \
LC_ALL=${DEF_LC_ALL} \
CUSTOMIZE=${DEF_CUSTOMIZE} \
CUSTOM_ENTRYPOINTS_DIR=${DEF_CUSTOM_ENTRYPOINTS_DIR} \
AUTO_START_BROWSER=${DEF_AUTO_START_BROWSER} \
AUTO_START_XTERM=${DEF_AUTO_START_XTERM}
# Install necessary packages and setup noVNC
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
apk update && \
apk upgrade && \
apk add --no-cache \
tini \
supervisor \
bash \
xvfb \
x11vnc \
novnc \
websockify \
fluxbox \
xterm \
nano \
firefox && \
ln -s /usr/share/novnc/vnc_lite.html /usr/share/novnc/index.html
# Create necessary directories for supervisor and custom entrypoints
RUN mkdir -p /etc/supervisor.d /app/conf.d ${DEF_CUSTOM_ENTRYPOINTS_DIR}
RUN mkdir -p /var/log/supervisor
# Copy configuration files
COPY supervisord.conf /etc/supervisor.d/supervisord.conf
COPY conf.d/ /app/conf.d/
COPY base_entrypoint.sh customizable_entrypoint.sh /usr/local/bin/
COPY browser_conf/firefox.conf /app/conf.d/
# Make the entrypoint scripts executable
RUN chmod +x /usr/local/bin/base_entrypoint.sh /usr/local/bin/customizable_entrypoint.sh
# Expose the standard VNC and noVNC ports
EXPOSE ${VNC_PORT} ${NOVNC_WEBSOCKIFY_PORT}
# Set tini as the entrypoint and the custom script as the command
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/local/bin/customizable_entrypoint.sh"]