From ada5786d95a658e046e7786e91649ed6f4d2ad37 Mon Sep 17 00:00:00 2001 From: Jin Igarashi Date: Tue, 9 Apr 2024 14:10:33 +0900 Subject: [PATCH 1/3] fix: fixed docker-compose.yml and renamed gdal_rio.env to .env.example --- gdal_rio.env => .env.example | 0 Dockerfile | 10 ++++++---- README.md | 4 ++-- docker-compose.yml | 15 ++------------- 4 files changed, 10 insertions(+), 19 deletions(-) rename gdal_rio.env => .env.example (100%) 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..68386e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,24 +3,13 @@ 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. - ports: - - "${PORT}:${PORT}" - - - + - .env From b22ca4eb848b651176895990be8e7438d823e2be Mon Sep 17 00:00:00 2001 From: Jin Igarashi Date: Tue, 9 Apr 2024 14:24:05 +0900 Subject: [PATCH 2/3] fix: added port for docker --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 68386e6..3d265fa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,3 +13,5 @@ services: - "./src/cogserver:/opt/server/cogserver" env_file: - .env + ports: + - 8000:$PORT From 730ca31a6dc95dbdc545ff1d89b3130593dadb1e Mon Sep 17 00:00:00 2001 From: Jin Igarashi Date: Tue, 9 Apr 2024 14:54:50 +0900 Subject: [PATCH 3/3] revert port setting --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3d265fa..24004bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,4 +14,4 @@ services: env_file: - .env ports: - - 8000:$PORT + - "${PORT}:${PORT}"