Skip to content

Commit

Permalink
Setting bitnami uvicorn 3.9 as default image for kubernetes and pushing
Browse files Browse the repository at this point in the history
it alongside normal gunicorn image.

Signed-off-by: Maik Fischer <maik.fischer@lgln.niedersachsen.de>
  • Loading branch information
FischerLGLN committed Oct 6, 2022
1 parent 29439cc commit f53ad99
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check_charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
# See https://github.com/developmentseed/titiler/discussions/387
platforms: linux/amd64
context: .
file: dockerfiles/Dockerfile.gunicorn
file: dockerfiles/Dockerfile.uvicorn
push: false
tags: "titiler:dev"

Expand All @@ -75,4 +75,4 @@ jobs:
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: ct install --chart-dirs deployment/k8s
run: ct install --chart-dirs deployment/k8s
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,34 @@ jobs:
id: tag
# https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
# Uvicorn
# Push `latest` when commiting to master
- name: Build and push uvicorn
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v2
with:
# See https://github.com/developmentseed/titiler/discussions/387
platforms: linux/amd64
context: .
file: dockerfiles/Dockerfile.uvicorn
push: true
tags: |
ghcr.io/${{ github.repository }}-uvicorn:latest
# Push `{VERSION}` when pushing a new tag
- name: Build and push uvicorn
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: docker/build-push-action@v2
with:
# See https://github.com/developmentseed/titiler/discussions/387
platforms: linux/amd64
context: .
file: dockerfiles/Dockerfile.uvicorn
push: true
tags: |
ghcr.io/${{ github.repository }}-uvicorn:${{ steps.tag.outputs.tag }}
# Gunicorn
# Push `latest` when commiting to master
- name: Build and push
if: github.ref == 'refs/heads/master'
Expand Down
2 changes: 1 addition & 1 deletion deployment/k8s/charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
replicaCount: 1

image:
repository: ghcr.io/developmentseed/titiler
repository: ghcr.io/developmentseed/titiler-uvicorn
tag: latest
pullPolicy: IfNotPresent

Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile.gunicorn
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ RUN pip install /tmp/titiler/core /tmp/titiler/mosaic /tmp/titiler/application -
RUN rm -rf /tmp/titiler

ENV MODULE_NAME titiler.application.main
ENV VARIABLE_NAME app
ENV VARIABLE_NAME app
10 changes: 5 additions & 5 deletions dockerfiles/Dockerfile.uvicorn
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Dockerfile for running titiler application with uvicorn server
# Size ~600MB
ARG PYTHON_VERSION=3.9

FROM python:${PYTHON_VERSION}-slim

RUN apt-get update && apt-get install curl -y
FROM bitnami/python:${PYTHON_VERSION}
RUN apt update && apt upgrade -y \
&& apt install curl -y \
&& rm -rf /var/lib/apt/lists/*

# Ensure root certificates are always updated at evey container build
# and curl is using the latest version of them
Expand All @@ -15,7 +15,7 @@ RUN update-ca-certificates
ENV CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt

COPY src/titiler/ /tmp/titiler/
RUN pip install /tmp/titiler/core /tmp/titiler/mosaic /tmp/titiler/application["server"] --no-cache-dir --upgrade
RUN pip install uvicorn /tmp/titiler/core /tmp/titiler/mosaic /tmp/titiler/application["server"] --no-cache-dir --upgrade
RUN rm -rf /tmp/titiler

ENV HOST 0.0.0.0
Expand Down

0 comments on commit f53ad99

Please sign in to comment.