-
Notifications
You must be signed in to change notification settings - Fork 741
/
Dockerfile
53 lines (36 loc) · 1.51 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
FROM python:3.11.4-slim-bullseye AS compile-image
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install --no-install-recommends -y \
build-essential && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN python -m venv /app
# Make sure we use the virtualenv:
ENV PATH="/app/bin:$PATH"
RUN pip config --user set global.extra-index-url https://www.piwheels.org/simple
COPY requirements.txt .
# RUN python3 -m pip install --no-cache-dir -U pip && \
RUN pip3 install --upgrade --no-cache-dir pip && \
python3 -m pip install --no-cache-dir -r requirements.txt
COPY . /app
FROM python:3.11.4-slim-bullseye
ARG REPO=whittlem/pycryptobot
LABEL org.opencontainers.image.source https://github.com/${REPO}
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install --no-install-recommends -y \
libatlas3-base libfreetype6 libjpeg62-turbo \
libopenjp2-7 libtiff5 libxcb1 && \
rm -rf /var/lib/apt/lists/* && \
groupadd -g 1000 pycryptobot && \
useradd -r -u 1000 -g pycryptobot pycryptobot && \
mkdir -p /app/.config/matplotlib && \
chown -R pycryptobot:pycryptobot /app
WORKDIR /app
USER pycryptobot
# Make sure we use the virtualenv:
ENV PATH="/app/bin:$PATH"
# Make sure we have a config dir for matplotlib when we not the root user
ENV MPLCONFIGDIR="/app/.config/matplotlib"
COPY --chown=pycryptobot:pycryptobot --from=compile-image /app /app
# Pass parameters to the container run or mount your config.json into /app/
ENTRYPOINT [ "python3", "-u", "pycryptobot.py" ]