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

move around setting stuff so that docker build process works

parent aa1316b4
Branches
Tags
1 merge request!1apiserver based on fastAPI
...@@ -59,7 +59,7 @@ The `context.py` file helps with importing the apiserver-packages, so that the t ...@@ -59,7 +59,7 @@ The `context.py` file helps with importing the apiserver-packages, so that the t
To build the docker image of the current version, simply run To build the docker image of the current version, simply run
```bash ```bash
docker built -t datacatalog-apiserver ./apiserver docker build -t datacatalog-apiserver ./apiserver
``` ```
while in the project root directory. while in the project root directory.
......
**/__pycache__
**/.pytest_cache
README.md
Dockerfile
.dockerignore
\ No newline at end of file
...@@ -2,15 +2,19 @@ FROM tiangolo/uvicorn-gunicorn:python3.8 ...@@ -2,15 +2,19 @@ FROM tiangolo/uvicorn-gunicorn:python3.8
LABEL maintainer="Christian Böttcher <c.boettcher@fz-juelich.de>" LABEL maintainer="Christian Böttcher <c.boettcher@fz-juelich.de>"
RUN mkdir -p /app/app/data RUN mkdir -p /app/data
RUN mkdir -p /app/app/storage RUN mkdir -p /app/apiserver
RUN apt update && apt upgrade -y RUN apt update && apt upgrade -y
RUN pip install --no-cache-dir fastapi RUN pip install --no-cache-dir fastapi
COPY ./__init__.py /app/app/ ADD . /app/apiserver
COPY ./main.py /app/app/ COPY ./config.env /app/apiserver/config.env
COPY ./storage/JsonFileStorageAdapter.py /app/app/storage/
COPY ./storage/LocationStorage.py /app/app/storage/ # This RUN creates a python file that contains the fastapi app, in a location that is expected by the base docker image
COPY ./storage/__init__.py /app/app/storage/ # This avoids naming conflicts with the packages in the project folder
\ No newline at end of file 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
...@@ -10,4 +10,4 @@ class ApiserverSettings(BaseSettings): ...@@ -10,4 +10,4 @@ class ApiserverSettings(BaseSettings):
class Config: class Config:
env_prefix: str = "datacatalog_apiserver_" env_prefix: str = "datacatalog_apiserver_"
env_file: str = "config.env" env_file: str = "apiserver/config.env"
\ No newline at end of file \ No newline at end of file
...@@ -19,7 +19,7 @@ from enum import Enum ...@@ -19,7 +19,7 @@ from enum import Enum
settings = ApiserverSettings() settings = ApiserverSettings()
app = FastAPI( app = FastAPI(
title="API-Server for the Data Catalogue" title="API-Server for the Data Catalog"
) )
adapter: AbstractLocationDataStorageAdapter = JsonFileStorageAdapter(settings) adapter: AbstractLocationDataStorageAdapter = JsonFileStorageAdapter(settings)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment