-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
79 lines (61 loc) · 1.94 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
FROM python:3.11-buster AS builder
WORKDIR /app
RUN pip install poetry
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=true \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_CACHE_DIR='/tmp/poetry_cache'\
PATH="/app/.venv/bin:$PATH" \
USER=dockeruser \
USER_ID=1000 \
GROUP=dockergroup \
GROUP_ID=1000
COPY --chown=${USER}:${GROUP} --chmod=0755 pyproject.toml poetry.lock README.md /app/
RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR
FROM python:3.11-slim-buster AS runtime
WORKDIR /app
ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH" \
USER=dockeruser \
USER_ID=1000 \
GROUP=dockergroup \
GROUP_ID=1000
RUN apt-get update && apt-get install -y \
gosu procps \
fontconfig \
fonts-dejavu-core \
fonts-liberation \
fonts-noto \
fonts-freefont-ttf \
bluetooth \
bluez \
tshark \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd --gid "${GROUP_ID}" "${GROUP}" && \
useradd \
--uid "${USER_ID}" \
--gid "${GROUP}" \
--create-home \
--home /var/empty \
--shell /bin/nologin \
"${USER}" && \
mkdir -p /config /data /logs && \
chown -R "${USER}":"${GROUP}" /config /logs && \
chmod -R a+rwX /config /logs
COPY --from=builder --chown=${USER}:${GROUP} --chmod=0755 ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY --chown=${USER}:${GROUP} --chmod=0755 coolledx /app/coolledx
COPY --chown=${USER}:${GROUP} --chmod=0755 run_scripts /app/run_scripts
COPY --chown=${USER}:${GROUP} --chmod=0755 utils /app/utils
# COPY --chown=${USER}:${GROUP} --chmod=a+rw default_config /config
# USER "${USER}"
# Set up the environment variables we're expecting
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONPATH=/app \
LOGFILE=/logs/coolledx.log
# TODO:
# CONFIGFILE=/config/coolledx.yaml \
VOLUME /config /logs
# EXPOSE <port>
ENTRYPOINT ["/app/run_scripts/start_coolledx.sh"]
CMD []