-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
34 lines (27 loc) · 967 Bytes
/
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
FROM python:3-alpine
#
# Create a base UID/GID and SUID/SGID which will be used by container
#
RUN addgroup -S --gid 1000 rcb \
&& adduser -S -G rcb -u 1000 -s /bin/bash rcb \
&& mkdir -p /run/user/1000 \
&& chown -R rcb /run/user/1000 /home/rcb \
&& echo rcb:100000:65536 | tee /etc/subuid | tee /etc/subgid
ENV HOME /home/rcb
ENV USER rcb
ENV XDG_RUNTIME_DIR=/run/user/1000
# NOTE: it's ad-hoc solution to check that daemon proccess is running as well as bot proccess
HEALTHCHECK \
CMD [ $(ps aux | grep [p]ython | wc -l ) -eq 2 ] && exit 0 || exit 1
RUN mkdir -p ${HOME}/bot
COPY requirements.txt ${HOME}/bot
RUN apk update \
&& apk add --virtual build-deps gcc g++ python3-dev musl-dev \
&& apk add --no-cache mariadb-dev \
&& pip3 install --upgrade pip \
&& pip3 install --no-cache-dir -r ${HOME}/bot/requirements.txt \
&& apk del build-deps gcc g++
USER rcb
COPY ./src ${HOME}/bot/src
WORKDIR ${HOME}/bot/src
ENTRYPOINT ["python3", "main.py"]