2023-01-30 15:18:17 +00:00
|
|
|
# Base image to share ENV vars that activate VENV.
|
|
|
|
FROM ghcr.io/sartography/python:3.11 AS base
|
|
|
|
|
|
|
|
ENV VIRTUAL_ENV=/app/venv
|
|
|
|
RUN python3 -m venv $VIRTUAL_ENV
|
|
|
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2023-01-31 21:14:22 +00:00
|
|
|
# base plus packages needed for deployment. Could just install these in final, but then we can't cache as much.
|
2023-02-22 20:16:13 +00:00
|
|
|
# vim is just for debugging
|
2023-01-31 21:14:22 +00:00
|
|
|
FROM base AS deployment
|
|
|
|
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get clean -y \
|
2023-02-22 20:16:13 +00:00
|
|
|
&& apt-get install -y -q curl git-core gunicorn3 default-mysql-client vim \
|
2023-01-31 21:14:22 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2023-01-30 15:18:17 +00:00
|
|
|
# Setup image for installing Python dependencies.
|
|
|
|
FROM base AS setup
|
2022-06-01 18:50:44 +00:00
|
|
|
|
|
|
|
RUN pip install poetry
|
|
|
|
RUN useradd _gunicorn --no-create-home --user-group
|
|
|
|
|
2023-01-30 15:18:17 +00:00
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y -q gcc libssl-dev libpq-dev
|
2022-06-01 18:50:44 +00:00
|
|
|
|
2023-02-01 12:53:35 +00:00
|
|
|
# poetry install takes a long time and can be cached if dependencies don't change,
|
|
|
|
# so that's why we tolerate running it twice.
|
|
|
|
COPY pyproject.toml poetry.lock /app/
|
|
|
|
RUN poetry install --without dev
|
|
|
|
|
2023-01-30 15:18:17 +00:00
|
|
|
COPY . /app
|
2022-11-09 20:44:28 +00:00
|
|
|
RUN poetry install --without dev
|
2022-06-01 18:50:44 +00:00
|
|
|
|
2023-01-30 15:18:17 +00:00
|
|
|
# Final image without setup dependencies.
|
2023-01-31 21:14:22 +00:00
|
|
|
FROM deployment AS final
|
2022-06-01 18:50:44 +00:00
|
|
|
|
2023-01-30 15:18:17 +00:00
|
|
|
LABEL source="https://github.com/sartography/spiff-arena"
|
|
|
|
LABEL description="Software development platform for building, running, and monitoring executable diagrams"
|
2022-06-01 18:50:44 +00:00
|
|
|
|
2023-01-30 15:18:17 +00:00
|
|
|
COPY --from=setup /app /app
|
2022-06-01 18:50:44 +00:00
|
|
|
|
2023-01-31 21:14:22 +00:00
|
|
|
CMD ["./bin/boot_server_in_docker"]
|