diff --git a/gdal_rio.env b/.env.example similarity index 100% rename from gdal_rio.env rename to .env.example diff --git a/Dockerfile b/Dockerfile index d654092..689a19b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,10 @@ RUN pipenv run pip install -U pip COPY requirements.txt requirements.txt RUN pipenv run pip install -r requirements.txt COPY src/cogserver cogserver -ENV HOST=0.0.0.0 -ENV PORT=8000 -ENV LOG_LEVEL=info -ENV RELOAD=--reload + +ARG HOST=0.0.0.0 +ARG PORT=8000 +ARG LOG_LEVEL=info +ARG RELOAD=--reload + CMD pipenv run uvicorn cogserver:app --host ${HOST} --port ${PORT} --log-level ${LOG_LEVEL} ${RELOAD} diff --git a/README.md b/README.md index af5e2aa..d7aa125 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,11 @@ a) pushing tags ``` # local development -The server's config variables are defined in [gdal_rio.env](/gdal_rio.env). By passing this file at runtime to +The server's config variables are defined in [.env](.env). To create `.env` file, please copy `env.example` file by using the command of `cp .env.example .env`. By passing this file at runtime to docker-compose the server can be started using: ```commandline - docker-compose --env-file gdal_rio.env up --build + docker-compose --env-file .env up --build ``` [gdal_rio.env](/gdal_rio.env) contains several important environmental variables. diff --git a/docker-compose.yml b/docker-compose.yml index 1c94672..24004bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,24 +3,15 @@ version: '3' services: cogserver: # See https://github.com/developmentseed/titiler/discussions/387 - #platform: linux/amd64 + platform: linux/amd64 # enable `image` if you would like to use Docker image from Github package #image: ghcr.io/undp-data/cogserver:latest - # enable `build` if you would like to build Docker image from source code -# image: undpgeohub.azurecr.io/cogserver-debug build: context: . - container_name: cogserver # Enable the following volumes if you want to mount source code to Docker volumes: - "./src/cogserver:/opt/server/cogserver" env_file: - - ./gdal_rio.env - environment: - - RELOAD=--reload - # the above env file contains the $PORT variable. + - .env ports: - "${PORT}:${PORT}" - - -