-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
43 lines (27 loc) · 944 Bytes
/
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
FROM python:3.10 AS builder
RUN pip install --user pipenv
# Tell pipenv to create venv in the current directory
ENV PIPENV_VENV_IN_PROJECT=1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# only copy in lockfile - install from locked deps
COPY Pipfile.lock /app/Pipfile.lock
WORKDIR /app
RUN /root/.local/bin/pipenv sync
COPY .git .git
RUN echo $(git rev-parse --short HEAD) > .version
RUN echo $(date -Is) >> .version
FROM python:3.10-slim AS runtime
WORKDIR /app
# copy venv into runtime
COPY --from=builder /app/.venv/ /app/.venv/
COPY --from=builder /app/.version /app/.version
# add venv to path
ENV PATH="/app/.venv/bin:$PATH"
# let apollo know that it's in a container
ENV CONTAINER=1
# copy in everything
COPY . /app
# build default alembic config into container, we rarely want to change this
RUN /bin/bash -c 'if [[ ! -f alembic.ini ]]; then mv alembic.example.ini alembic.ini; fi'
CMD [ "python", "apollo.py" ]