generated from topsport-com-au/python-docker-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (39 loc) · 1.19 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
ARG base_image
FROM ${base_image}
# Set shell pipefail
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Create working directory
RUN mkdir -p /workspace
WORKDIR /workspace
# Set python env vars
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
POETRY_HOME="/opt/poetry" \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=0 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# Set path
ENV PATH="$POETRY_HOME/bin:$PATH"
# Install poetry
RUN apt-get update \
&& apt-get -y --no-install-recommends install curl default-libmysqlclient-dev \
&& curl -sSL https://install.python-poetry.org | python - \
&& apt-get -y purge curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies
ARG poetry_options=""
COPY poetry.lock pyproject.toml ./
RUN apt-get update \
&& apt-get -y install --no-install-recommends python3-dev build-essential \
&& poetry install ${poetry_options} --no-root \
&& apt-get -y purge python3-dev build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy files
COPY . ./
# Install root package
RUN poetry install ${poetry_options}
CMD ["scripts/entry"]