-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (23 loc) · 918 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
FROM python:3.7.4-buster
RUN pip install virtualenv
# Set up the current timezone, s.t. synchonization with external services is properly working
RUN echo "Europe/Berlin" > /etc/timezone && \
ln -fs /usr/share/zoneinfo/`cat /etc/timezone` /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata
# register the user variables
ARG USER
ARG UID
ARG GID
# set the proper user. this is especially helpful for debugging. (the user isn't admin but you may use sudo)
ENV HOME /home/${USER}
RUN groupadd --gid ${GID} --non-unique ${USER}
RUN useradd --home-dir $HOME --create-home --shell /bin/bash --uid $UID $USER -g ${GID} && \
adduser $USER sudo && \
passwd -d $USER
RUN mkdir -p $HOME/.cache/pip
RUN chown -R $UID:$GID $HOME/.cache
USER $UID
WORKDIR $HOME
RUN virtualenv /tmp/venv
COPY requirements.txt /tmp/
RUN . /tmp/venv/bin/activate && pip install -r /tmp/requirements.txt