feat: total refactoring of project, code, depns and workflow
This commit is contained in:
35
Dockerfile
35
Dockerfile
@@ -1,10 +1,31 @@
|
||||
FROM python:latest
|
||||
FROM python:3.10.2-slim-bullseye as base
|
||||
|
||||
# Install dependencies.
|
||||
ADD requirements.txt /requirements.txt
|
||||
RUN pip install -r requirements.txt
|
||||
ENV PYTHONFAULTHANDLER=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PYTHONHASHSEED=random \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
# pip:
|
||||
PIP_NO_CACHE_DIR=off \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
||||
PIP_DEFAULT_TIMEOUT=100 \
|
||||
# poetry:
|
||||
POETRY_VERSION=1.1.13 \
|
||||
POETRY_NO_INTERACTION=1 \
|
||||
POETRY_VIRTUALENVS_CREATE=false \
|
||||
POETRY_CACHE_DIR='/var/cache/pypoetry' \
|
||||
PATH="$PATH:/root/.local/bin"
|
||||
|
||||
# Copy code.
|
||||
ADD main.py /main.py
|
||||
WORKDIR /src
|
||||
|
||||
CMD ["python", "/main.py"]
|
||||
# install poetry
|
||||
# RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
|
||||
RUN pip install pipx
|
||||
RUN pipx install "poetry==$POETRY_VERSION"
|
||||
|
||||
# install dependencies
|
||||
COPY pyproject.toml poetry.lock /src/
|
||||
RUN poetry install --no-dev --no-root --no-interaction --no-ansi
|
||||
|
||||
# copy and run program
|
||||
COPY main.py /src/
|
||||
RUN python /src/main.py
|
||||
|
||||
Reference in New Issue
Block a user