forked from aerosense-ai/openfast-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (31 loc) · 1.28 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
FROM ghcr.io/openfast/openfast:3.5.3
# Allow statements and log messages to immediately appear in the Knative logs on Google Cloud.
ENV PYTHONUNBUFFERED True
ENV PROJECT_ROOT=/workspace
WORKDIR $PROJECT_ROOT
RUN apt-get update -y && apt-get install -y --fix-missing curl python3.11 && rm -rf /var/lib/apt/lists/*
# Install poetry.
ENV POETRY_HOME=/root/.poetry
ENV PATH "$POETRY_HOME/bin:$PATH"
RUN curl -sSL https://install.python-poetry.org | python3.11 - && poetry config virtualenvs.create false;
# Copy in dependency files for caching.
COPY pyproject.toml poetry.lock ./
# Install just the dependencies to utilise layer caching for quick rebuilds.
RUN poetry install \
--no-ansi \
--no-interaction \
--no-cache \
--no-root \
--only main
COPY . .
# Install local packages.
RUN poetry install --only main
EXPOSE $PORT
ENV USE_OCTUE_LOG_HANDLER=1
ENV COMPUTE_PROVIDER=GOOGLE_CLOUD_RUN
ARG GUNICORN_WORKERS=1
ENV GUNICORN_WORKERS=$GUNICORN_WORKERS
ARG GUNICORN_THREADS=8
ENV GUNICORN_THREADS=$GUNICORN_THREADS
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
CMD exec gunicorn --bind :$PORT --workers $GUNICORN_WORKERS --threads $GUNICORN_THREADS --timeout 0 octue.cloud.deployment.google.cloud_run.flask_app:app