Skip to content

Commit

Permalink
Following iron-up and fixes for container builds (#398)
Browse files Browse the repository at this point in the history
- Trigger docker build on tag push

- Add release job to action

- Correcting the registry credentials for dockerhub

- full build for non-base images
  • Loading branch information
unkcpz committed Jul 10, 2023
1 parent 0897d53 commit a457f9b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ on:
push:
branches:
- main
tags:
- "v*"
paths:
- ".github/workflows/docker.yml"
# We use local reusable workflows to make architecture clean an simple
Expand Down Expand Up @@ -165,14 +167,14 @@ jobs:
uses: ./.github/workflows/docker-push.yml
strategy:
matrix:
image: ["base", "base-with-services"]
image: ["base", "base-with-services", "lab", "full-stack"]
with:
architecture: amd64
image: ${{ matrix.image }}
registry: docker.io
secrets:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.DOCKER_PASSWORD }}
needs: [amd64-base, amd64-base-with-services, amd64-lab, amd64-full-stack]

arm64-push-dockerhub:
Expand All @@ -186,8 +188,8 @@ jobs:
image: ${{ matrix.image }}
registry: docker.io
secrets:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.DOCKER_PASSWORD }}
needs: [arm64-base, arm64-base-with-services, arm64-lab, arm64-full-stack]

merge-tags-dockerhub:
Expand All @@ -200,6 +202,18 @@ jobs:
image: ${{ matrix.image }}
registry: docker.io
secrets:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.DOCKER_PASSWORD }}
needs: [amd64-push-dockerhub, arm64-push-dockerhub]

release:
runs-on: ubuntu-latest
needs: [merge-tags-ghcr, merge-tags-dockerhub]
steps:
- uses: actions/checkout@v3

- name: Create release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
if: github.repository == 'aiidalab/aiidalab-docker-stack' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
5 changes: 0 additions & 5 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ variable "PLATFORMS" {
default = ["linux/amd64"]
}

function "arch2platform" {
params = [arch]
result = "linux/${arch}"
}

variable "TARGETS" {
default = ["base", "base-with-services", "lab", "full-stack"]
}
Expand Down
4 changes: 1 addition & 3 deletions stack/base-with-services/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# syntax=docker/dockerfile:1
ARG OWNER=aiidalab
ARG BASE_CONTAINER=$OWNER/base
FROM $BASE_CONTAINER
FROM base

LABEL maintainer="AiiDAlab Team <aiidalab@materialscloud.org>"

Expand Down
5 changes: 2 additions & 3 deletions stack/full-stack/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# syntax=docker/dockerfile:1
ARG OWNER=aiidalab
FROM $OWNER/base-with-services as base
FROM base-with-services as base

FROM $OWNER/lab
FROM lab

USER root

Expand Down
4 changes: 1 addition & 3 deletions stack/lab/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# syntax=docker/dockerfile:1
ARG OWNER=aiidalab
ARG BASE_CONTAINER=$OWNER/base
FROM $BASE_CONTAINER
FROM base

LABEL maintainer="AiiDAlab Team <aiidalab@materialscloud.org>"

Expand Down

0 comments on commit a457f9b

Please sign in to comment.