-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (58 loc) · 1.86 KB
/
Dockerfile
File metadata and controls
66 lines (58 loc) · 1.86 KB
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
59
60
61
62
63
64
65
66
FROM python:3.8-buster
# Configure Python to be nice inside Docker and pip to stfu
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PIP_DEFAULT_TIMEOUT 100
ENV PIP_DISABLE_PIP_VERSION_CHECK 1
ENV PIP_NO_CACHE_DIR 1
ENV LANG C.UTF-8
# Install necessary packages for build and runtime
WORKDIR /home/docker/
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \
apt-get -y update && \
apt-get -y install eatmydata && \
eatmydata apt-get -y upgrade && \
eatmydata apt-get install -y --no-install-recommends \
build-essential \
gettext \
libmariadbclient-dev \
nodejs npm yarn \
rabbitmq-server; \
eatmydata pip install poetry uwsgi mysqlclient;
# Install backend dependencies
WORKDIR /var/www/
#COPY poetry.lock /var/www/
COPY pyproject.toml /var/www/
RUN set -e; \
mkdir -p /var/www/media /var/www/static; \
sed -i '/documento-/c\' pyproject.toml; \
poetry config virtualenvs.create false; \
eatmydata poetry install --no-dev;
# Install frontend dependencies
WORKDIR /var/www/frontend/
COPY frontend/yarn.lock /var/www/frontend/
COPY frontend/package.json /var/www/frontend/
RUN yarn install
# Build frontend
COPY frontend/ /var/www/frontend
RUN yarn build
# Clean up build dependencies
WORKDIR /var/www/
RUN set -e; \
eatmydata apt-get remove --purge -y \
build-essential \
yarn npm nodejs \
gettext; \
eatmydata apt-get autoremove --purge -y; \
apt-get clean -y; \
eatmydata pip uninstall -y poetry; \
rm -f /var/lib/apt/lists/*_*; \
rm -rf /root/.cache
# Copy app files
COPY docker-setup/uwsgi-app.ini /etc/uwsgi/apps-enabled/uwsgi-app.ini
COPY docker-setup/init_and_run.sh /home/docker/init_and_run.sh
COPY . /var/www/
# Finish
EXPOSE 3031
CMD ["/home/docker/init_and_run.sh"]