@@ -3,6 +3,9 @@ name: Docker images
33
44# Run this Build for all pushes to 'main' or maintenance branches, or tagged releases.
55# Also run for PRs to ensure PR doesn't break Docker build process
6+ # NOTE: uses "reusable-docker-build.yml" in DSpace/DSpace to actually build each of the Docker images
7+ # https://github.com/DSpace/DSpace/blob/dspace-7_x/.github/workflows/reusable-docker-build.yml
8+ #
69on :
710 push :
811 branches :
@@ -16,105 +19,41 @@ permissions:
1619 contents : read # to fetch code (actions/checkout)
1720
1821jobs :
19- docker :
22+ # ############################################################
23+ # Build/Push the 'dspace/dspace-angular' image
24+ # ############################################################
25+ dspace-angular :
2026 # Ensure this job never runs on forked repos. It's only executed for 'dspace/dspace-angular'
2127 if : github.repository == 'dspace/dspace-angular'
22- runs-on : ubuntu-latest
23- env :
24- # Define tags to use for Docker images based on Git tags/branches (for docker/metadata-action)
25- # For a new commit on default branch (main), use the literal tag 'dspace-7_x' on Docker image.
26- # For a new commit on other branches, use the branch name as the tag for Docker image.
27- # For a new tag, copy that tag name as the tag for Docker image.
28- IMAGE_TAGS : |
29- type=raw,value=dspace-7_x,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
30- type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }}
31- type=ref,event=tag
32- # Define default tag "flavor" for docker/metadata-action per
33- # https://github.com/docker/metadata-action#flavor-input
34- # We turn off 'latest' tag by default.
35- TAGS_FLAVOR : |
36- latest=false
37- # Architectures / Platforms for which we will build Docker images
38- # If this is a PR, we ONLY build for AMD64. For PRs we only do a sanity check test to ensure Docker builds work.
39- # If this is NOT a PR (e.g. a tag or merge commit), also build for ARM64.
40- PLATFORMS : linux/amd64${{ github.event_name != 'pull_request' && ', linux/arm64' || '' }}
41-
42- steps :
43- # https://github.com/actions/checkout
44- - name : Checkout codebase
45- uses : actions/checkout@v3
46-
47- # https://github.com/docker/setup-buildx-action
48- - name : Setup Docker Buildx
49- uses : docker/setup-buildx-action@v2
50-
51- # https://github.com/docker/setup-qemu-action
52- - name : Set up QEMU emulation to build for multiple architectures
53- uses : docker/setup-qemu-action@v2
54-
55- # https://github.com/docker/login-action
56- - name : Login to DockerHub
57- # Only login if not a PR, as PRs only trigger a Docker build and not a push
58- if : github.event_name != 'pull_request'
59- uses : docker/login-action@v2
60- with :
61- username : ${{ secrets.DOCKER_USERNAME }}
62- password : ${{ secrets.DOCKER_ACCESS_TOKEN }}
63-
64- # ##############################################
65- # Build/Push the 'dspace/dspace-angular' image
66- # ##############################################
67- # https://github.com/docker/metadata-action
68- # Get Metadata for docker_build step below
69- - name : Sync metadata (tags, labels) from GitHub to Docker for 'dspace-angular' image
70- id : meta_build
71- uses : docker/metadata-action@v4
72- with :
73- images : dspace/dspace-angular
74- tags : ${{ env.IMAGE_TAGS }}
75- flavor : ${{ env.TAGS_FLAVOR }}
76-
77- # https://github.com/docker/build-push-action
78- - name : Build and push 'dspace-angular' image
79- id : docker_build
80- uses : docker/build-push-action@v3
81- with :
82- context : .
83- file : ./Dockerfile
84- platforms : ${{ env.PLATFORMS }}
85- # For pull requests, we run the Docker build (to ensure no PR changes break the build),
86- # but we ONLY do an image push to DockerHub if it's NOT a PR
87- push : ${{ github.event_name != 'pull_request' }}
88- # Use tags / labels provided by 'docker/metadata-action' above
89- tags : ${{ steps.meta_build.outputs.tags }}
90- labels : ${{ steps.meta_build.outputs.labels }}
91-
92- # ####################################################
93- # Build/Push the 'dspace/dspace-angular' image ('-dist' tag)
94- # ####################################################
95- # https://github.com/docker/metadata-action
96- # Get Metadata for docker_build_dist step below
97- - name : Sync metadata (tags, labels) from GitHub to Docker for 'dspace-angular-dist' image
98- id : meta_build_dist
99- uses : docker/metadata-action@v4
100- with :
101- images : dspace/dspace-angular
102- tags : ${{ env.IMAGE_TAGS }}
103- # As this is a "dist" image, its tags are all suffixed with "-dist". Otherwise, it uses the same
104- # tagging logic as the primary 'dspace/dspace-angular' image above.
105- flavor : ${{ env.TAGS_FLAVOR }}
106- suffix=-dist
107-
108- - name : Build and push 'dspace-angular-dist' image
109- id : docker_build_dist
110- uses : docker/build-push-action@v3
111- with :
112- context : .
113- file : ./Dockerfile.dist
114- platforms : ${{ env.PLATFORMS }}
115- # For pull requests, we run the Docker build (to ensure no PR changes break the build),
116- # but we ONLY do an image push to DockerHub if it's NOT a PR
117- push : ${{ github.event_name != 'pull_request' }}
118- # Use tags / labels provided by 'docker/metadata-action' above
119- tags : ${{ steps.meta_build_dist.outputs.tags }}
120- labels : ${{ steps.meta_build_dist.outputs.labels }}
28+ # Use the reusable-docker-build.yml script from DSpace/DSpace repo to build our Docker image
29+ uses : DSpace/DSpace/.github/workflows/reusable-docker-build.yml@dspace-7_x
30+ with :
31+ build_id : dspace-angular-dev
32+ image_name : dspace/dspace-angular
33+ dockerfile_path : ./Dockerfile
34+ secrets :
35+ DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
36+ DOCKER_ACCESS_TOKEN : ${{ secrets.DOCKER_ACCESS_TOKEN }}
37+
38+ # ############################################################
39+ # Build/Push the 'dspace/dspace-angular' image ('-dist' tag)
40+ # ############################################################
41+ dspace-angular-dist :
42+ # Ensure this job never runs on forked repos. It's only executed for 'dspace/dspace-angular'
43+ if : github.repository == 'dspace/dspace-angular'
44+ # Use the reusable-docker-build.yml script from DSpace/DSpace repo to build our Docker image
45+ uses : DSpace/DSpace/.github/workflows/reusable-docker-build.yml@dspace-7_x
46+ with :
47+ build_id : dspace-angular-dist
48+ image_name : dspace/dspace-angular
49+ dockerfile_path : ./Dockerfile.dist
50+ # As this is a "dist" image, its tags are all suffixed with "-dist". Otherwise, it uses the same
51+ # tagging logic as the primary 'dspace/dspace-angular' image above.
52+ tags_flavor : suffix=-dist
53+ secrets :
54+ DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
55+ DOCKER_ACCESS_TOKEN : ${{ secrets.DOCKER_ACCESS_TOKEN }}
56+ # Enable redeploy of sandbox & demo if the branch for this image matches the deployment branch of
57+ # these sites as specified in reusable-docker-build.xml
58+ REDEPLOY_SANDBOX_URL : ${{ secrets.REDEPLOY_SANDBOX_URL }}
59+ REDEPLOY_DEMO_URL : ${{ secrets.REDEPLOY_DEMO_URL }}
0 commit comments