-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (39 loc) · 1.37 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
ARG PYTHON_VERSION="3.11"
FROM python:${PYTHON_VERSION}
SHELL ["/bin/bash", "-c"]
# set timezone
ARG TIMEZONE="Europe/Warsaw"
RUN set -Eeuxo pipefail && \
apt-get update && \
apt-get install --no-install-recommends -y \
tzdata && \
echo "${TIMEZONE}" > /etc/timezone && \
cp "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime && \
apt-get -qy autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# add a non-root user
ARG USER_ID=1000
ARG GROUP_ID=1000
ARG AUX_GROUP_IDS=""
RUN set -Eeuxo pipefail && \
(addgroup --gid "${GROUP_ID}" user || echo "group ${GROUP_ID} already exists, so not adding it") && \
adduser --disabled-password --gecos "User" --uid "${USER_ID}" --gid "${GROUP_ID}" user && \
echo ${AUX_GROUP_IDS} | xargs -n1 echo | xargs -I% addgroup --gid % group% && \
echo ${AUX_GROUP_IDS} | xargs -n1 echo | xargs -I% usermod --append --groups group% user
# install dependencies
RUN set -Eeuxo pipefail && \
apt-get update && \
apt-get install --no-install-recommends -y \
docker.io \
net-tools && \
apt-get -qy autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /home/user/maildaemon
COPY --chown=${USER_ID}:${GROUP_ID} requirements*.txt ./
RUN set -Eeuxo pipefail && \
pip3 install --no-cache-dir -r requirements_ci.txt
# prepare maildaemon for testing
USER user
VOLUME ["/home/user/maildaemon"]