-
-
Notifications
You must be signed in to change notification settings - Fork 276
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 #6570 from hotosm/develop
v4.8.1 Latest changes to staging
- Loading branch information
Showing
90 changed files
with
5,305 additions
and
2,318 deletions.
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
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,4 +1,3 @@ | ||
# | ||
name: Build & publish TM backend container image | ||
|
||
on: | ||
|
@@ -18,50 +17,15 @@ on: | |
- deployment/container-tasking-manager | ||
|
||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
tags: | | ||
type=ref,event=pr | ||
type=ref,event=tag | ||
type=ref,event=branch | ||
type=semver,pattern=raw | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=sha | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
backend-build: | ||
uses: hotosm/gh-workflows/.github/workflows/[email protected] | ||
with: | ||
image_name: ghcr.io/${{ github.repository }}/backend | ||
build_target: prod | ||
|
||
# frontend-build: | ||
# uses: hotosm/gh-workflows/.github/workflows/[email protected] | ||
# with: | ||
# image_name: ghcr.io/${{ github.repository }}/backend | ||
# dockerfile: scripts/docker/Dockerfile.frontend |
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
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,10 +1,13 @@ | ||
ARG DEBIAN_IMG_TAG=slim-bookworm | ||
ARG PYTHON_IMG_TAG=3.10 | ||
|
||
|
||
|
||
FROM docker.io/python:${PYTHON_IMG_TAG}-${DEBIAN_IMG_TAG} as base | ||
ARG APP_VERSION=0.1.0 | ||
ARG DOCKERFILE_VERSION=0.5.0 | ||
ARG ALPINE_IMG_TAG | ||
ARG DEBIAN_IMG_TAG | ||
ARG PYTHON_IMG_TAG | ||
ARG [email protected] | ||
LABEL org.hotosm.tasks.app-version="${APP_VERSION}" \ | ||
|
@@ -25,7 +28,7 @@ FROM base as extract-deps | |
RUN pip install --no-cache-dir --upgrade pip | ||
WORKDIR /opt/python | ||
COPY pyproject.toml pdm.lock README.md /opt/python/ | ||
RUN pip install --no-cache-dir pdm==2.7.4 | ||
RUN pip install --no-cache-dir pdm==2.18.1 | ||
RUN pdm export --prod --without-hashes > requirements.txt | ||
|
||
|
||
|
@@ -34,13 +37,13 @@ FROM base as build | |
RUN pip install --no-cache-dir --upgrade pip | ||
WORKDIR /opt/python | ||
# Setup backend build-time dependencies | ||
RUN apt-get update | ||
RUN apt-get install --no-install-recommends -y build-essential | ||
RUN apt-get install --no-install-recommends -y \ | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
build-essential \ | ||
libffi-dev \ | ||
libgeos-dev \ | ||
postgresql-server-dev-15 \ | ||
python3-dev \ | ||
libffi-dev \ | ||
libgeos-dev | ||
&& rm -rf /var/lib/apt/lists/* | ||
# Setup backend Python dependencies | ||
COPY --from=extract-deps \ | ||
/opt/python/requirements.txt /opt/python/ | ||
|
@@ -63,8 +66,8 @@ ENV PYTHONDONTWRITEBYTECODE=1 \ | |
# Setup backend runtime dependencies | ||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
postgresql-client libgeos3.11.1 proj-bin && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
libgeos3.11.1 postgresql-client proj-bin && \ | ||
rm -rf /var/lib/apt/lists/* | ||
COPY --from=build \ | ||
/home/appuser/.local \ | ||
/home/appuser/.local | ||
|
@@ -79,7 +82,7 @@ COPY manage.py . | |
|
||
FROM runtime as debug | ||
RUN pip install --user --no-warn-script-location \ | ||
--no-cache-dir debugpy==1.6.7 | ||
--no-cache-dir debugpy==1.8.5 | ||
EXPOSE 5678/tcp | ||
CMD ["python", "-m", "debugpy", "--wait-for-client", "--listen", "0.0.0.0:5678", \ | ||
"-m", "gunicorn", "-c", "python:backend.gunicorn", "manage:application", \ | ||
|
@@ -91,12 +94,13 @@ FROM runtime as prod | |
USER root | ||
RUN apt-get update && \ | ||
apt-get install -y curl && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
# Pre-compile packages to .pyc (init speed gains) | ||
RUN python -c "import compileall; compileall.compile_path(maxlevels=10, quiet=1)" | ||
RUN python -m compileall . | ||
EXPOSE 5000/tcp | ||
USER appuser:appuser | ||
# Default gunicorn worker count is 1 | ||
# For prod the WEB_CONCURRENCY env var can be used to set this | ||
CMD ["gunicorn", "-c", "python:backend.gunicorn", "manage:application", \ | ||
"--workers", "1", "--log-level", "error"] | ||
"--log-level", "error"] |
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
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
Oops, something went wrong.