Skip to content

Commit

Permalink
Merge pull request #186 from panodata/fix-docker
Browse files Browse the repository at this point in the history
Fix official Docker image building by using wheel from working tree
  • Loading branch information
gutzbenj authored Sep 25, 2020
2 parents c18fdee + fcdae87 commit 0e001cf
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
!pytest.ini
!noxfile.py
!.coverragerc

!dist
3 changes: 2 additions & 1 deletion .github/release/full.test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sut:
build: full
build: ../..
dockerfile: .github/release/full/Dockerfile
# TODO: We might went to improve this. Just say "wetterdienst about system" here.
command: python -c 'import wradlib; print(wradlib.__version__)'
12 changes: 10 additions & 2 deletions .github/release/full/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ENV TERM linux

# Install GDAL.
RUN apt-get update
RUN apt-get --yes install build-essential libgdal-dev
RUN apt-get --yes install build-essential libgdal-dev libmariadbclient-dev

# Make sure you have numpy installed before you attempt to install the GDAL Python bindings.
# https://gis.stackexchange.com/a/274328
Expand All @@ -25,6 +25,9 @@ RUN pip install GDAL==$(gdal-config --version)
# Install wradlib.
RUN pip install wradlib

# Install database adapters
RUN pip install mysqlclient


# 2. Main
FROM python:3.8.5-slim
Expand All @@ -37,4 +40,9 @@ RUN apt-get --yes install libgdal20
COPY --from=build-step /usr/local/lib /usr/local/lib

# Install Wetterdienst.
RUN pip install wetterdienst[excel]

# Use "poetry build --format=wheel" to build wheel packages.
COPY dist/*.whl /tmp/

# Install latest wheel package.
RUN pip install $(ls -c /tmp/wetterdienst-*-py3-none-any.whl)[http,sql,excel,duckdb,influxdb,cratedb,mysql,postgresql]
3 changes: 2 additions & 1 deletion .github/release/standard.test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
sut:
build: standard
build: ../..
dockerfile: .github/release/standard/Dockerfile
command: wetterdienst about parameters
6 changes: 5 additions & 1 deletion .github/release/standard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ FROM python:3.8.5-slim
ENV DEBIAN_FRONTEND noninteractive
ENV TERM linux

RUN pip install wetterdienst[excel]
# Use "poetry build --format=wheel" to build wheel packages.
COPY dist/*.whl /tmp/

# Install latest wheel package.
RUN pip install $(ls -c /tmp/wetterdienst-*-py3-none-any.whl)[http,sql,excel]
31 changes: 27 additions & 4 deletions .github/workflows/docker-publish-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
# Publish `master` as Docker `latest` image.
branches:
- master
- test-docker

# Publish `v1.2.3` tags as releases.
tags:
Expand All @@ -24,7 +23,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Acquire sources
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install Poetry
run: pip install poetry==1.0.10

- name: Build wheel package
run: poetry build --format=wheel

- name: Run tests
run: |
Expand All @@ -43,9 +54,21 @@ jobs:
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2
- name: Acquire sources
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install Poetry
run: pip install poetry==1.0.10

- name: Build wheel package
run: poetry build --format=wheel

- name: Build image
- name: Build Docker image
run: docker build . --file .github/release/full/Dockerfile --tag $IMAGE_NAME

- name: Log into GitHub Container Registry
Expand Down
31 changes: 27 additions & 4 deletions .github/workflows/docker-publish-standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
# Publish `master` as Docker `latest` image.
branches:
- master
- test-docker

# Publish `v1.2.3` tags as releases.
tags:
Expand All @@ -24,7 +23,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Acquire sources
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install Poetry
run: pip install poetry==1.0.10

- name: Build wheel package
run: poetry build --format=wheel

- name: Run tests
run: |
Expand All @@ -43,9 +54,21 @@ jobs:
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2
- name: Acquire sources
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install Poetry
run: pip install poetry==1.0.10

- name: Build wheel package
run: poetry build --format=wheel

- name: Build image
- name: Build Docker image
run: docker build . --file .github/release/standard/Dockerfile --tag $IMAGE_NAME

- name: Log into GitHub Container Registry
Expand Down
53 changes: 36 additions & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ duckdb = { version = "^0.2.1", optional = true }
influxdb = { version = "^5.3.0", optional = true }
crate = { version = "^0.25.0", optional = true, extras = ["sqlalchemy"] }
mysqlclient = { version = "^2.0.1", optional = true }
psycopg2 = { version = "^2.8.6", optional = true }
psycopg2-binary = { version = "^2.8.6", optional = true }

fastapi = { version = "^0.61.1", optional = true }
uvicorn = { version = "^0.11.8", optional = true }
Expand All @@ -125,7 +125,7 @@ duckdb = ["duckdb"]
influxdb = ["influxdb"]
cratedb = ["crate"]
mysql = ["mysqlclient"]
postgresql = ["psycopg2"]
postgresql = ["psycopg2-binary"]

[tool.poetry.dev-dependencies]
nox = "^2020.8.22"
Expand Down

0 comments on commit 0e001cf

Please sign in to comment.