-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from UNDP-Data/feat/cicd
Feat/cicd
- Loading branch information
Showing
4 changed files
with
104 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Build, publish and deploy | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
pull_request: | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
|
||
context: . | ||
file: Dockerfile | ||
push: ${{ github.ref == 'refs/heads/main'}} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
secret-files: | | ||
"GDAL_RIO=../gdal_rio.env" |
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 +1,15 @@ | ||
FROM ghcr.io/developmentseed/titiler-uvicorn:latest | ||
FROM ghcr.io/osgeo/gdal:ubuntu-small-latest as base | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
libffi-dev python3-pip | ||
RUN python3 -m pip install pipenv | ||
RUN export PYTHON_VERSION="$(python3 --version | cut -d ' ' -f 2)" && pipenv --python ${PYTHON_VERSION} | ||
RUN pipenv run pip install -U pip | ||
RUN pipenv run pip install uvicorn titiler asyncpg postgis --no-cache-dir --upgrade | ||
|
||
|
||
WORKDIR /opt/server | ||
COPY src/cogserver cogserver | ||
|
||
CMD pipenv run uvicorn cogserver:app --host ${HOST} --port ${PORT} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: '3' | ||
|
||
services: | ||
cogserver: | ||
# See https://github.com/developmentseed/titiler/discussions/387 | ||
#platform: linux/amd64 | ||
# enable `image` if you would like to use Docker image from Github package | ||
# image: ghcr.io/undp-data/titiler-aks:v0.0.2 | ||
# enable `build` if you would like to build Docker image from source code | ||
build: | ||
context: . | ||
|
||
# Enable the following volumes if you want to mount source code to Docker | ||
# volumes: | ||
# - "./app/wmts.py:/opt/wmts/wmts.py" | ||
env_file: | ||
- gdal_rio.env | ||
ports: | ||
- 8000:80 | ||
# environment: | ||
# # Application | ||
# - HOST=0.0.0.0 | ||
# - PORT=8000 | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#Application | ||
HOST=0.0.0.0 | ||
PORT=80 | ||
## Uvicorn | ||
## http://www.uvicorn.org/settings/#production | ||
WEB_CONCURRENCY=2 | ||
## GDAL config | ||
CPL_TMPDIR=/tmp | ||
GDAL_CACHEMAX=75% | ||
GDAL_INGESTED_BYTES_AT_OPEN=32768 | ||
GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR | ||
GDAL_HTTP_MERGE_CONSECUTIVE_RANGES=YES | ||
GDAL_HTTP_MULTIPLEX=YES | ||
GDAL_HTTP_VERSION=2 | ||
PYTHONWARNINGS=ignore | ||
VSI_CACHE=TRUE | ||
VSI_CACHE_SIZE=5000000 | ||
## rio-tiler config | ||
RIO_TILER_MAX_THREADS=2 |