-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add backend-specific dockerfiles, publish images (#525)
* ci: bump pgstac * ci, docker: add backend-specific dockerfiles * Add changelog entry --------- Co-authored-by: Nathan Zimmerman <[email protected]>
- Loading branch information
1 parent
7f60b8a
commit 7ba0a40
Showing
11 changed files
with
204 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ jobs: | |
|
||
services: | ||
db_service: | ||
image: ghcr.io/stac-utils/pgstac:v0.6.12 | ||
image: ghcr.io/stac-utils/pgstac:v0.6.13 | ||
env: | ||
POSTGRES_USER: username | ||
POSTGRES_PASSWORD: password | ||
|
@@ -130,7 +130,7 @@ jobs: | |
backend: ["sqlalchemy", "pgstac"] | ||
services: | ||
pgstac: | ||
image: ghcr.io/stac-utils/pgstac:v0.6.11 | ||
image: ghcr.io/stac-utils/pgstac:v0.6.13 | ||
env: | ||
POSTGRES_USER: username | ||
POSTGRES_PASSWORD: password | ||
|
@@ -187,3 +187,41 @@ jobs: | |
- uses: actions/checkout@v3 | ||
- name: Test generating docs | ||
run: make docs | ||
|
||
docker-build-push: | ||
runs-on: ubuntu-latest | ||
needs: [test, validate, test-docs] | ||
permissions: | ||
contents: read | ||
packages: write | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
backend: ["sqlalchemy", "pgstac"] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ghcr.io/stac-utils/stac-fastapi | ||
tags: | | ||
type=schedule,suffix=-${{ matrix.backend }} | ||
type=ref,event=branch,suffix=-${{ matrix.backend }} | ||
type=ref,event=tag,suffix=-${{ matrix.backend }} | ||
type=ref,event=pr,suffix=-${{ matrix.backend }} | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
file: docker/Dockerfile.${{ matrix.backend }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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
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
File renamed without changes.
File renamed without changes.
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 @@ | ||
FROM python:3.8-slim as builder | ||
|
||
RUN python -m venv /opt/venv | ||
|
||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN pip install ./stac_fastapi/types && \ | ||
pip install ./stac_fastapi/api && \ | ||
pip install ./stac_fastapi/extensions && \ | ||
pip install ./stac_fastapi/pgstac[server] | ||
|
||
|
||
FROM python:3.8-slim as pgstac | ||
|
||
ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt | ||
|
||
COPY --from=builder /opt/venv /opt/venv | ||
|
||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
CMD ["uvicorn", "stac_fastapi.pgstac.app:app", "--host", "0.0.0.0", "--port", "8080"] |
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,27 @@ | ||
FROM python:3.8-slim as builder | ||
|
||
RUN python -m venv /opt/venv | ||
|
||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN pip install ./stac_fastapi/types && \ | ||
pip install ./stac_fastapi/api && \ | ||
pip install ./stac_fastapi/extensions && \ | ||
pip install ./stac_fastapi/sqlalchemy[server] | ||
|
||
|
||
FROM python:3.8-slim as sqlalchemy | ||
|
||
ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt | ||
|
||
COPY --from=builder /opt/venv /opt/venv | ||
COPY ./stac_fastapi/sqlalchemy/alembic /app/alembic | ||
COPY ./stac_fastapi/sqlalchemy/alembic.ini /app/alembic.ini | ||
|
||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
CMD ["uvicorn", "stac_fastapi.sqlalchemy.app:app", "--host", "0.0.0.0", "--port", "8080"] |
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,43 @@ | ||
version: '3' | ||
services: | ||
stac-fastapi-pgstac: | ||
image: ghcr.io/stac-utils/stac-fastapi:latest-pgstac | ||
platform: linux/amd64 | ||
environment: | ||
- APP_HOST=0.0.0.0 | ||
- ENVIRONMENT=local | ||
- POSTGRES_USER=username | ||
- POSTGRES_PASS=password | ||
- POSTGRES_DBNAME=postgis | ||
- POSTGRES_HOST_READER=pgstac | ||
- POSTGRES_HOST_WRITER=pgstac | ||
- POSTGRES_PORT=5432 | ||
- WEB_CONCURRENCY=10 | ||
- VSI_CACHE=TRUE | ||
- GDAL_HTTP_MERGE_CONSECUTIVE_RANGES=YES | ||
- GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR | ||
- DB_MIN_CONN_SIZE=1 | ||
- DB_MAX_CONN_SIZE=1 | ||
- USE_API_HYDRATE=${USE_API_HYDRATE:-false} | ||
ports: | ||
- "8080:8080" | ||
depends_on: | ||
- pgstac | ||
|
||
pgstac: | ||
image: ghcr.io/stac-utils/pgstac:v0.6.13 | ||
environment: | ||
- POSTGRES_USER=username | ||
- POSTGRES_PASSWORD=password | ||
- POSTGRES_DB=postgis | ||
- PGUSER=username | ||
- PGPASSWORD=password | ||
- PGHOST=localhost | ||
- PGDATABASE=postgis | ||
ports: | ||
- "5439:5432" | ||
command: postgres -N 500 | ||
|
||
networks: | ||
default: | ||
name: stac-fastapi-network |
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,49 @@ | ||
version: '3' | ||
services: | ||
stac-fastapi-sqlalchemy: | ||
image: ghcr.io/stac-utils/stac-fastapi:latest-sqlalchemy | ||
platform: linux/amd64 | ||
environment: | ||
- APP_HOST=0.0.0.0 | ||
- APP_PORT=8080 | ||
- POSTGRES_USER=username | ||
- POSTGRES_PASS=password | ||
- POSTGRES_DBNAME=postgis | ||
- POSTGRES_HOST_READER=pgstac | ||
- POSTGRES_HOST_WRITER=pgstac | ||
- POSTGRES_PORT=5432 | ||
- WEB_CONCURRENCY=10 | ||
ports: | ||
- "8080:8080" | ||
depends_on: | ||
- pgstac | ||
|
||
pgstac: | ||
image: ghcr.io/stac-utils/pgstac:v0.6.13 | ||
environment: | ||
- POSTGRES_USER=username | ||
- POSTGRES_PASSWORD=password | ||
- POSTGRES_DB=postgis | ||
- PGUSER=username | ||
- PGPASSWORD=password | ||
- PGHOST=localhost | ||
- PGDATABASE=postgis | ||
ports: | ||
- "5439:5432" | ||
command: postgres -N 500 | ||
|
||
migrate: | ||
image: ghcr.io/stac-utils/stac-fastapi:latest-sqlalchemy | ||
command: bash -c "cd /app && alembic upgrade head" | ||
environment: | ||
- POSTGRES_USER=username | ||
- POSTGRES_PASS=password | ||
- POSTGRES_DBNAME=postgis | ||
- POSTGRES_HOST=pgstac | ||
- POSTGRES_PORT=5432 | ||
depends_on: | ||
- stac-fastapi-sqlalchemy | ||
|
||
networks: | ||
default: | ||
name: stac-fastapi-network |