-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
62 lines (39 loc) · 1.82 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
59
60
61
62
FROM node:20-buster-slim as builder
COPY ./muse-for-anything-ui /muse-for-anything-ui
RUN mkdir --parents /muse_for_anything/static \
&& cd muse-for-anything-ui \
&& npm clean-install \
&& npx browserslist@latest --update-db \
&& npm run build
FROM python:3.10-slim
LABEL org.opencontainers.image.source="https://github.com/Muster-Suchen-und-Erkennen/muse-for-anything"
# Upgrade dependencies
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && apt-get install -y gcc python-dev-is-python3 libpq-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
#RUN python -m pip install --upgrade pip
RUN python -m pip install gunicorn poetry
ENV POETRY_VIRTUALENVS_CREATE=false
RUN useradd gunicorn
ENV FLASK_APP=muse_for_anything
ENV CONCURRENCY=2
COPY --chown=gunicorn ./poetry.lock ./pyproject.toml ./tasks.py /app/
COPY --chown=gunicorn ./migrations /app/migrations
COPY --chown=gunicorn ./muse_for_anything /app/muse_for_anything
COPY --chown=gunicorn ./translations /app/translations
WORKDIR /app
COPY --chown=gunicorn --from=builder ./muse_for_anything/static /app/muse_for_anything/static
RUN python -m poetry export --without-hashes --extras=psycopg2 --extras=PyMySQL --format=requirements.txt -o requirements.txt && python -m pip install -r requirements.txt
ARG SKIP_PASSWORD_HASHING_CHECKS=force
ARG M4A_SECRET_KEY="build-time-only-secret"
# optimize static assets
RUN python -m flask digest compile
# add instance folder and make it read/write
RUN mkdir --parents /app/instance && chown gunicorn /app/instance && chmod u+rw /app/instance
VOLUME ["/app/instance"]
ENV M4A_INSTANCE_PATH="/app/instance"
EXPOSE 8080
# Wait for database
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /wait
RUN chmod +x /wait
USER gunicorn
CMD ["python", "-m", "invoke", "start-docker"]