-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
46 lines (30 loc) · 1.17 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
FROM python:3.9-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 python -m pip install --no-cache-dir -U pip && \
python3 -m pip install --no-cache-dir -r requirements.txt
COPY . /app
FROM python:3.9-slim-bullseye
ARG REPO=whittlem/logwebtail
LABEL org.opencontainers.image.source https://github.com/${REPO}
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
rm -rf /var/lib/apt/lists/* && \
groupadd -g 1000 logwebtail && \
useradd -r -u 1000 -g logwebtail logwebtail && \
mkdir -p /app && \
chown -R logwebtail:logwebtail /app
WORKDIR /app
USER logwebtail
# Make sure we use the virtualenv:
ENV PATH="/app/bin:$PATH"
COPY --chown=logwebtail:logwebtail --from=compile-image /app /app
# Pass parameters to the container run or mount your config.json into /app/
ENTRYPOINT [ "python3", "-u", "main.py" ]