Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove build and publish base and base-with-services to registry #412

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 12 additions & 43 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,101 +59,70 @@ concurrency:
cancel-in-progress: true

jobs:
amd64-base:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: base
architecture: amd64
runsOn: ubuntu-latest

amd64-base-with-services:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: base-with-services
architecture: amd64
runsOn: ubuntu-latest
needs: [amd64-base]

amd64-lab:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: lab
architecture: amd64
runsOn: ubuntu-latest
needs: [amd64-base]

amd64-full-stack:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: full-stack
architecture: amd64
runsOn: ubuntu-latest
needs: [amd64-base-with-services, amd64-lab]

arm64-base:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: base
architecture: arm64
runsOn: ARM64
needs: [amd64-lab]

arm64-lab:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: lab
architecture: arm64
runsOn: ARM64
needs: [arm64-base]

arm64-base-with-services:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: base-with-services
architecture: arm64
runsOn: ARM64
needs: [arm64-base]

arm64-full-stack:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: full-stack
architecture: arm64
runsOn: ARM64
needs: [arm64-base-with-services, arm64-lab]
needs: [arm64-lab]

amd64-push-ghcr:
uses: ./.github/workflows/docker-push.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack"]
image: ["lab", "full-stack"]
with:
architecture: amd64
image: ${{ matrix.image }}
registry: ghcr.io
secrets:
REGISTRY_USERNAME: ${{ github.actor }}
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
needs: [amd64-base, amd64-base-with-services, amd64-lab, amd64-full-stack]
needs: [amd64-lab, amd64-full-stack]

arm64-push-ghcr:
uses: ./.github/workflows/docker-push.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack"]
image: ["lab", "full-stack"]
with:
architecture: arm64
image: ${{ matrix.image }}
registry: ghcr.io
secrets:
REGISTRY_USERNAME: ${{ github.actor }}
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
needs: [arm64-base, arm64-base-with-services, arm64-lab, arm64-full-stack]
needs: [arm64-lab, arm64-full-stack]

merge-tags-ghcr:
uses: ./.github/workflows/docker-merge-tags.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack"]
image: ["lab", "full-stack"]
with:
image: ${{ matrix.image }}
registry: ghcr.io
Expand All @@ -167,37 +136,37 @@ jobs:
uses: ./.github/workflows/docker-push.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack"]
image: ["lab", "full-stack"]
with:
architecture: amd64
image: ${{ matrix.image }}
registry: docker.io
secrets:
REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.DOCKER_PASSWORD }}
needs: [amd64-base, amd64-base-with-services, amd64-lab, amd64-full-stack]
needs: [amd64-lab, amd64-full-stack]

arm64-push-dockerhub:
if: github.repository == 'aiidalab/aiidalab-docker-stack' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: ./.github/workflows/docker-push.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack"]
image: ["lab", "full-stack"]
with:
architecture: arm64
image: ${{ matrix.image }}
registry: docker.io
secrets:
REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.DOCKER_PASSWORD }}
needs: [arm64-base, arm64-base-with-services, arm64-lab, arm64-full-stack]
needs: [arm64-lab, arm64-full-stack]

merge-tags-dockerhub:
if: github.repository == 'aiidalab/aiidalab-docker-stack' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: ./.github/workflows/docker-merge-tags.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack"]
image: ["lab", "full-stack"]
with:
image: ${{ matrix.image }}
registry: docker.io
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ This repository contains the Dockerfiles for the official AiiDAlab docker image
All images are based on the [jupyter/minimal-notebook](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#jupyter-minimal-notebook).

Image variants:
- `base` – A minimal image that comes with AiiDA pre-installed and an AiiDA profile set up.
- `base-with-services` – Like `base`, but AiiDA services (PostgreSQL and RabbitMQ) are installed on the container and automatically launched on startup.
- `lab` – Like `base`, but uses the AiiDAlab home app as the primary interface (the standard JupyterLab interface is also available).
- `lab` – A minimal image that comes with AiiDA pre-installed and an AiiDA profile setup, uses the AiiDAlab home app as the primary interface (the standard JupyterLab interface is also available).
- `full-stack` – Our most comprehensive image, like `lab`, but also comes with services pre-installed and launched.

Supported tags (released on [Docker Hub](https://hub.docker.com/r/aiidalab)):
Expand Down Expand Up @@ -55,7 +53,7 @@ The build system will attempt to detect the local architecture and automatically
All commands `build`, `tests`, and `up` will use the locally detected platform and use a version tag based on the state of the local git repository.
However, you can also specify a custom platform or version with the `--platform` and `--version` parameters, example: `doit build --arch=arm64 --version=my-version`.

You can specify target stacks to build with `--target`, example: `doit build --target base --target full-stack`.
You can specify target stacks to build with `--target`, example: `doit build --target lab --target full-stack`.

### Run automated tests

Expand Down
19 changes: 0 additions & 19 deletions stack/docker-compose.base-with-services.yml

This file was deleted.

48 changes: 0 additions & 48 deletions stack/docker-compose.base.yml

This file was deleted.

2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def pytest_addoption(parser):
parser.addoption(
"--variant",
action="store",
default="base",
default="lab",
help="Variant (image name) of the docker-compose file to use.",
)

Expand Down
21 changes: 0 additions & 21 deletions tests/test-base-with-services.py

This file was deleted.

53 changes: 0 additions & 53 deletions tests/test-base.py

This file was deleted.

54 changes: 53 additions & 1 deletion tests/test-common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,57 @@
"""Tests for all images, which are docker/docker-compose related tests."""
"""Tests for all images, which are docker/docker-compose related and AiiDA/package management related tests."""
import requests
import pytest
import json
from packaging.version import parse


@pytest.mark.parametrize("incompatible_version", ["1.6.3"])
def test_prevent_pip_install_of_incompatible_aiida_version(
aiidalab_exec, nb_user, aiida_version, incompatible_version
):
package_manager = "pip"
assert parse(aiida_version) != parse(incompatible_version)
# Expected to succeed:
aiidalab_exec(
f"{package_manager} install aiida-core=={aiida_version}", user=nb_user
)
with pytest.raises(Exception):
aiidalab_exec(
f"{package_manager} install aiida-core=={incompatible_version}",
user=nb_user,
)


def test_correct_python_version_installed(aiidalab_exec, python_version):
info = json.loads(aiidalab_exec("mamba list --json --full-name python").decode())[0]
assert info["name"] == "python"
assert parse(info["version"]) == parse(python_version)


def test_create_conda_environment(aiidalab_exec, nb_user):
output = aiidalab_exec("conda create -y -n tmp", user=nb_user).decode().strip()
assert "conda activate tmp" in output
# New conda environments should be created in ~/.conda/envs/
output = aiidalab_exec("conda env list", user=nb_user).decode().strip()
assert f"/home/{nb_user}/.conda/envs/tmp" in output


def test_pip_check(aiidalab_exec):
aiidalab_exec("pip check")


def test_correct_aiida_version_installed(aiidalab_exec, aiida_version):
info = json.loads(
aiidalab_exec("mamba list --json --full-name aiida-core").decode()
)[0]
assert info["name"] == "aiida-core"
assert parse(info["version"]) == parse(aiida_version)


def test_path_local_pip(aiidalab_exec, nb_user):
"""test that the pip local bin path ~/.local/bin is added to PATH"""
output = aiidalab_exec("bash -c 'echo \"${PATH}\"'", user=nb_user).decode()
assert f"/home/{nb_user}/.local/bin" in output


def test_notebook_service_available(notebook_service):
Expand Down
Loading