Skip to content

Commit

Permalink
add dockerfile and related configs
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Nov 10, 2023
1 parent 1855b73 commit 1b0ba5c
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 11 deletions.
28 changes: 28 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## IDE
.idea/
.vscode/

## SCM
.git*

## Configurations
.*
*.rc

## Environment
.conda/
.env*
*.env
.venv/
jupyter/

## Tests
.coverage
.pytest_cache
reports

## Caches
**/__pycache__/
STACpopulator.egg-info/
build
*.pyc
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
release:
name: release
runs-on: ubuntu-latest
# FIXME: until working
## if: ${{ success() && (contains(github.ref, 'refs/tags') || github.ref == 'refs/heads/master') }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -47,5 +49,6 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
file: docker/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}
24 changes: 17 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
## IDE
.idea/
.vscode/

## Environment
.conda/
.env*
*.env
.venv/
jupyter/

## Tests
.coverage
.pytest_cache
build
reports
*.pyc

## Caches
**/__pycache__/
STACpopulator.egg-info/
.vscode/
.venv/
jupyter/
.idea
.vscode
build
*.pyc
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ APP_ROOT := $(abspath $(lastword $(MAKEFILE_NAME))/..)
APP_NAME := STACpopulator
APP_VERSION ?= 0.1.0

DOCKER_COMPOSE_FILES := -f "$(APP_ROOT)/docker/docker-compose.yml"
DOCKER_TAG := ghcr.io/crim-ca/stac-populator:$(APP_VERSION)

IMP_DIR := $(APP_NAME)/implementations
STAC_HOST ?= http://localhost:8880/stac
Expand All @@ -26,13 +28,16 @@ del-cmip6:
@echo ""

docker-start:
docker compose up
docker compose $(DOCKER_COMPOSE_FILES) up
starthost: docker-start

docker-stop:
docker compose down
docker compose $(DOCKER_COMPOSE_FILES) down
stophost: docker-stop

docker-build:
docker build "$(APP_ROOT)" -f "$(APP_ROOT)/docker/Dockerfile" -t "$(DOCKER_TAG)"

del_docker_volume: stophost
docker volume rm stac-populator_stac-db

Expand Down
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,33 @@ Provided implementations of `STACpopulatorBase`:

[CMIP6_UofT]: STACpopulator/implementations/CMIP6_UofT/add_CMIP6.py

## Installation and Execution

Either with Python directly (in an environment of your choosing):

```shell
pip install .
# OR
make install
```

With development packages:

```shell
pip install .[dev]
# OR
make install-dev
```

You can also employ the pre-built Docker:

```shell
docker run -ti ghcr.io/crim-ca/stac-populator:0.1.0 [command]
```

## Testing

The provided [`docker-compose`](docker-compose.yml) configuration file can be used to launch a test STAC server.
The provided [`docker-compose`](docker/docker-compose.yml) configuration file can be used to launch a test STAC server.
For example, the [CMIP6_UofT][CMIP6_UofT] script can be run as:

```shell
Expand Down
32 changes: 32 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM python:3.10-slim
LABEL description.short="STAC Populator"
LABEL description.long="Utility to populate STAC Catalog, Collections and Items from various dataset/catalog sources."
LABEL maintainer="Francis Charette-Migneault <[email protected]>"
LABEL vendor="CRIM"
LABEL version="0.1.0"

# setup paths
ENV APP_DIR=/opt/local/src/stac-populator
WORKDIR ${APP_DIR}

# obtain source files
COPY STACpopulator/ ${APP_DIR}/STACpopulator/
COPY README.md LICENSE pyproject.toml ${APP_DIR}/

# install runtime/package dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
netbase \
git \
&& mkdir -p /home/stac/.esdoc/ \
&& git clone "https://github.com/ES-DOC/pyessv-archive" /home/stac/.esdoc/pyessv-archive/ \
&& pip install --no-cache-dir ${APP_DIR} \
&& apt-get remove -y \
git \
&& rm -rf /var/lib/apt/lists/*

RUN groupadd -r stac && useradd -r -g stac stac
USER stac

# FIXME: use common CLI
CMD ["bash"]
File renamed without changes.
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exclude = [
[project]
name = "STACpopulator"
version = "0.1.0"
description = "Utility for populating the STAC Catalog, Collections and Items from various dataset/catalog sources."
description = "Utility to populate STAC Catalog, Collections and Items from various dataset/catalog sources."
requires-python = ">=3.10"
dependencies = [
"colorlog",
Expand Down Expand Up @@ -134,6 +134,11 @@ filename = "Makefile"
search = "APP_VERSION ?= {current_version}"
replace = "APP_VERSION ?= {new_version}"

[[tool.bumpversion.files]]
filename = "docker/Dockerfile"
search = "LABEL version=\"{current_version}\""
replace = "LABEL version=\"{new_version}\""

[[tool.bumpversion.files]]
filename = "CHANGES.md"
search = "## [Unreleased](https://github.com/crim-ca/stac-populator) (latest)"
Expand Down

0 comments on commit 1b0ba5c

Please sign in to comment.