-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
51 lines (30 loc) · 1.15 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
FROM docker-registry.ebrains.eu/hdc-services-image/base-image:python-3.10.12-v2 AS production-environment
ENV PYTHONDONTWRITEBYTECODE=true \
PYTHONIOENCODING=UTF-8 \
POETRY_VERSION=1.3.2 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_CREATE=false
ENV PATH="${POETRY_HOME}/bin:${PATH}"
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
build-essential
# Having curl installed in the image is a potential security liability
# So we remove it once we don't need it anymore
RUN curl -sSL https://install.python-poetry.org | python3 - && \
apt-get remove curl -y
COPY poetry.lock pyproject.toml ./
COPY notification ./notification
RUN poetry install --no-dev --no-interaction
FROM production-environment AS notification-image
RUN chown -R app:app /app
USER app
ENTRYPOINT ["python3", "-m", "notification"]
FROM production-environment AS development-environment
RUN poetry install --no-interaction
FROM development-environment AS alembic-image
ENV ALEMBIC_CONFIG=migrations/alembic.ini
COPY migrations ./migrations
RUN chown -R app:app /app
USER app
ENTRYPOINT ["python3", "-m", "alembic"]
CMD ["upgrade", "head"]