-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The existing base image seems to be abandoned and are not seeing updates anymore. This isn't sustainable in the long run and a new base images is implemented. The container is now based on a condaforge image which allows us to use the conda environment used in development.
- Loading branch information
Showing
2 changed files
with
20 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,29 @@ | ||
# See https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker | ||
# for notes on how to use this particular Docker image. | ||
# | ||
# In summary: Make sure that a /app/main.py file with a FastAPI-object called | ||
# 'app' is present and everything should run smoothly with all the bells and | ||
# whistles of a properly configured HTTP server | ||
|
||
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9 | ||
FROM condaforge/miniforge3 | ||
|
||
# We store PROJ ressources in $WEBPROJ_LIB | ||
ENV WEBPROJ_LIB /proj | ||
RUN mkdir $WEBPROJ_LIB | ||
|
||
RUN mkdir /proj | ||
|
||
# Copy necessary files. Tests and README are needed by setup.py | ||
COPY /webproj /webproj/webproj | ||
COPY /tests /webproj/tests | ||
COPY /app /webproj/app | ||
COPY /tests /webproj/tests | ||
COPY /setup.py /webproj/setup.py | ||
COPY /environment.yaml /webproj/environment.yaml | ||
COPY /README.md /webproj/README.md | ||
COPY /app/main.py /app/main.py | ||
|
||
WORKDIR /webproj | ||
|
||
# Running upgrade for security | ||
RUN apt update -y && apt upgrade -y | ||
RUN apt-get update -y && apt-get upgrade -y | ||
|
||
# Setup Python environment | ||
RUN pip install --upgrade pip | ||
RUN pip install pyproj | ||
RUN pip install fastapi | ||
RUN pip install unicorn | ||
RUN pip install httpx | ||
RUN pip install /webproj | ||
# Set up virtual environment | ||
RUN conda env create -f environment.yaml | ||
RUN conda run -n webproj python -m pip install --no-deps . | ||
|
||
# Sync PROJ-data files | ||
RUN pyproj sync --source-id dk_sdfe | ||
RUN conda run -n webproj pyproj sync --source-id dk_sdfe --target-dir $WEBPROJ_LIB | ||
|
||
CMD ["conda", "run", "-n", "webproj", "uvicorn", "--proxy-headers", "app.main:app", "--host", "0.0.0.0", "--port", "80"] | ||
|
||
EXPOSE 80 |