-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (38 loc) · 1.29 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
FROM python:3.10-alpine3.20 AS builder
MAINTAINER Chaojie Yan
# Setup basic Linux packages
RUN apk update && \
apk add --no-cache tini tzdata build-base libffi-dev make && \
apk upgrade && \
rm -rf /var/cache/apk/*
# Set workdir
WORKDIR /app/bili-jean/
COPY . .
ENV PYTHONUNBUFFERED=1 \
# prevents python creating .pyc files
PYTHONDONTWRITEBYTECODE=1 \
# poetry
# https://python-poetry.org/docs/configuration/#using-environment-variables
POETRY_VERSION=1.8.3 \
# do not ask any interactive question
POETRY_NO_INTERACTION=1 \
# no virtual env need for container
POETRY_VIRTUALENVS_CREATE=false
# prepend poetry and venv to path
ENV PATH="$POETRY_HOME/bin:$PATH"
# Add PYTHONPATH
ENV PYTHONPATH /app/bili-jean/
# install dependencies
RUN python -m pip install --no-cache --upgrade pip && \
python -m pip install --no-cache poetry==${POETRY_VERSION} && \
poetry install && \
find /usr/local/ -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
FROM python:3.10-alpine3.20 AS dev
COPY --from=builder /etc/ /etc/
COPY --from=builder /usr/ /usr/
COPY --from=builder /app/bili-jean/ /app/bili-jean/
COPY --from=builder /sbin/ /sbin/
# Set workdir
WORKDIR /app/bili-jean/
# Tini is now available at /sbin/tini
ENTRYPOINT ["/sbin/tini", "--"]