-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
42 lines (28 loc) · 964 Bytes
/
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
ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION} as build
RUN pip install --no-cache-dir --upgrade pip==24.1.1 \
&& apt-get update \
&& apt-get install -y --no-install-recommends gcc libpq-dev build-essential
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt /requirements.txt
RUN pip install --no-cache-dir -r /requirements.txt \
&& apt-get autoremove -y gcc build-essential \
&& apt-get clean -y \
&& rm -rf /root/.cache \
&& rm -rf /var/apt/lists/* \
&& rm -rf /var/cache/apt/*
FROM python:${PYTHON_VERSION}
ARG APP_VERSION
ENV APP_VERSION=${APP_VERSION}
RUN apt-get update \
&& apt-get install -y --no-install-recommends libpq-dev \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
WORKDIR /code
COPY entrypoint.sh /code/entrypoint.sh
COPY app/ /code/app/
EXPOSE 8000
CMD ["bash", "./entrypoint.sh"]