-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (42 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
50
51
52
53
54
55
56
57
58
FROM debian:bookworm-slim as base
ARG DEBIAN_FRONTEND noninteractive
# Locales
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV VIRTUAL_ENV /opt/astronomican_venv
ENV PATH ${VIRTUAL_ENV}/bin:${PATH}
ENV DJANGO_SETTINGS_MODULE astronomican.settings.production
ENV PYTHONDONTWRITEBYTECODE 1
WORKDIR /opt/astronomican
RUN useradd -m --shell /bin/false astronomican
RUN set -eux; \
{ \
echo "locales locales/default_environment_locale select en_US.UTF-8"; \
echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8"; \
} | debconf-set-selections; \
apt-get update; \
apt-get -y dist-upgrade; \
savedAptMark="$(apt-mark showmanual)"; \
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \
apt-get -y install --no-install-recommends \
python3 \
python3-venv \
python3-pip \
libmariadb3 \
locales; \
apt-get clean all; \
rm -rf /var/lib/apt/*
FROM base as builder
COPY requirements.txt requirements.txt
RUN set -eux; \
apt-get update; \
apt-get -y install --no-install-recommends pkg-config build-essential python3-dev default-libmysqlclient-dev; \
python3 -m venv "${VIRTUAL_ENV}"; \
pip install -r requirements.txt
FROM base as production
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY . .
USER astronomican
CMD [ "gunicorn", "astronomican.wsgi:application" ]