forked from pycontw/pycon.tw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.Dockerfile
52 lines (41 loc) · 1.29 KB
/
dev.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
# [Node Stage to get node_modolues and node dependencies]
FROM node:8.16.0-buster-slim as node_stage
COPY ./yarn.lock yarn.lock
COPY ./package.json package.json
RUN apt-get update
RUN apt-get install python-pip -y
RUN npm install -g yarn
RUN yarn install --dev --frozen-lockfile
# [Python Stage for Django web server]
FROM python:3.10.14-slim-bullseye as python_stage
WORKDIR /app
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1
# Infrastructure tools
# gettext is used for django to compile .po to .mo files.
RUN apt-get update
RUN apt-get install -y \
libpq-dev \
gcc \
zlib1g-dev \
libjpeg62-turbo-dev \
mime-support \
gettext \
libxml2-dev \
libxslt-dev
# Install Poetry
RUN pip install --no-cache-dir pip==23.3.2 && \
pip install --no-cache-dir poetry==1.8.2
# Install Python dependencies
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-root && \
yes | poetry cache clear --all pypi
# Add poetry bin directory to PATH
ENV PATH="${WORKDIR}/.venv/bin:$PATH"
COPY --from=node_stage /node_modules ./node_modules
COPY --from=node_stage /usr/local/bin/node /usr/local/bin/node