-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (35 loc) · 1.43 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
FROM python:3.11-slim as dependencies
# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get install libpq-dev build-essential git -y --no-install-recommends \
&& apt-get -y clean \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt
COPY requirements/base.txt /requirements/
RUN pip install --no-warn-script-location --no-cache-dir --prefix=/install -r /requirements/base.txt
FROM python:3.11-slim AS runtime
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH "${PYTHONPATH}:/${PWD}"
# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get install libpq-dev netcat-openbsd tzdata -y --no-install-recommends \
&& apt-get -y clean \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt
ENV TZ America/Mexico_City
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Copy dependencies
COPY --from=dependencies /install/bin /usr/local/bin
COPY --from=dependencies /install/lib /usr/local/lib
COPY app /app
WORKDIR /app
FROM runtime AS development
COPY scripts/entrypoint.sh scripts/start-receiver-dev.sh /
ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "/start-receiver-dev.sh" ]
FROM runtime AS production
COPY scripts/entrypoint.sh scripts/start-receiver-prod.sh /
ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "/start-receiver-prod.sh" ]