-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (38 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
47
48
49
50
51
52
53
54
FROM python:3.9-slim as python-base
ENV POETRY_VERSION=1.2.2 \
POETRY_NO_INTERACTION=1 \
POETRY_HOME="/opt/poetry" \
# Make poetry create virtualenvs in the project root
POETRY_VIRTUALENVS_IN_PROJECT=true \
# PIP
PIP_NO_CACHE_DIR=off \
PIP_DISABIBLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
# PATHS
PYSETUP_PATH="/opt/pysetup" \
VENV_PATH="/opt/pysetup/.venv"
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
FROM python-base as builder
# System packages
RUN apt update && apt upgrade -y && apt install --no-install-recommends -y \
build-essential \
curl
# Poetry installation
RUN curl -sSL "https://install.python-poetry.org" | python -
WORKDIR $PYSETUP_PATH
COPY ./poetry.lock ./pyproject.toml ./
RUN poetry install --no-dev --all-extras
# Development image
FROM python-base as development
WORKDIR $PYSETUP_PATH
COPY --from=builder $POETRY_HOME $POETRY_HOME
COPY --from=builder $PYSETUP_PATH $PYSETUP_PATH
RUN poetry install
WORKDIR /skylet-discord
# Production image
FROM python-base as production
# RUN mkdir $PYSETUP_PATH
COPY --from=builder $PYSETUP_PATH $PYSETUP_PATH
COPY . /skylet-discord
WORKDIR /skylet-discord
CMD ["sh", "scripts/start.sh"]