Skip to content
Snippets Groups Projects
Commit 2a564226 authored by Christian Boettcher's avatar Christian Boettcher
Browse files

new and smaller dockerfile

parent 604d4b11
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,7 @@ while in the project root directory.
To run the docker image in a local container, run
```bash
docker run -d --name <container name> -p 127.0.0.1:<local_port>:80 datacalog-apiserver
docker run -d --name <container name> -p 127.0.0.1:<local_port>:8000 datacalog-apiserver
```
`<container name>` is the name of your container, that can be used to refer to it with other docker commands.
......
FROM tiangolo/uvicorn-gunicorn:python3.8
FROM python:3.9-slim
LABEL maintainer="Christian Böttcher <c.boettcher@fz-juelich.de>"
EXPOSE 8000
RUN mkdir -p /app/data
RUN mkdir -p /app/apiserver
RUN apt update && apt upgrade -y
RUN pip install --no-cache-dir fastapi
RUN pip install "fastapi==0.63.0" \
"requests==2.25.1" \
"uvicorn==0.13.4" \
"python-dotenv==0.17.1" \
"python-multipart==0.0.5" \
"python-jose[cryptography]==3.2.0" \
"passlib[bcrypt]==1.7.4"
ADD . /app/apiserver
COPY ./config.env /app/apiserver/config.env
# This RUN creates a python file that contains the fastapi app, in a location that is expected by the base docker image
# This avoids naming conflicts with the packages in the project folder
RUN echo "from apiserver.main import app" > /app/main.py
# set data directory properly for the docker container
RUN sed -i 's_./app/data_/app/data_g' /app/apiserver/config.env
\ No newline at end of file
RUN sed -i 's_./app/data_/app/data_g' /app/apiserver/config.env && sed -i 's_./app/userdb.json_/app/userdb.json_g' /app/apiserver/config.env
WORKDIR /app
ENTRYPOINT ["uvicorn", "--host", "0.0.0.0", "apiserver:app"]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment