-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (28 loc) · 997 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
35
36
37
38
FROM python:3.11-slim-bullseye as builder
ARG WHEEL=difflume-0.6.0-py3-none-any.whl
ENV VENV=/venv
ENV PATH="$VENV/bin:$PATH"
WORKDIR /code
RUN python -m venv $VENV
# for caching purposes in CI
# waiting for https://github.com/moby/buildkit/issues/1512
# to replace with this:
#COPY ./dist/$WHEEL ./$WHEEL
#RUN --mount=type=cache,mode=0755,target=/root/.cache/pip \
# pip install --upgrade pip \
# && pip install --upgrade wheel \
# && pip install --upgrade ./$WHEEL
COPY ./dist/requirements.txt ./
RUN pip install --upgrade --no-cache-dir pip \
&& pip install --upgrade --no-cache-dir wheel \
&& pip install --upgrade --no-cache-dir -r requirements.txt
COPY ./dist/$WHEEL ./$WHEEL
RUN pip install --upgrade --no-cache-dir ./$WHEEL --no-deps
FROM python:3.11-slim-bullseye as production
RUN useradd -M appuser --uid=1000 --shell=/bin/false
USER appuser
ENV TERM=xterm-256color
ENV PATH="/venv/bin:$PATH"
WORKDIR /opt/app
COPY --from=builder /venv /venv
CMD ["difflume"]