diff --git a/.github/workflows/release-next.yml b/.github/workflows/release-next.yml new file mode 100644 index 0000000..ad29e70 --- /dev/null +++ b/.github/workflows/release-next.yml @@ -0,0 +1,94 @@ +name: Release new Docker image + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +env: + BASE_IMAGE_NAME: plone/frontend + PLATFORMS: linux/amd64,linux/arm64 + IS_LATEST: false + +jobs: + + meta: + runs-on: ubuntu-latest + outputs: + BASE_IMAGE_NAME: ${{ steps.vars.outputs.BASE_IMAGE_NAME }} + IS_LATEST: ${{ steps.vars.outputs.IS_LATEST }} + PLATFORMS: ${{ steps.vars.outputs.PLATFORMS }} + VOLTO_VERSION: ${{ steps.vars.outputs.VOLTO_VERSION }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set BASE_IMAGE_NAME, IS_LATEST, PLATFORMS, VOLTO_VERSION + id: vars + run: | + echo "BASE_IMAGE_NAME=$BASE_IMAGE_NAME" >> $GITHUB_OUTPUT + echo "PLATFORMS=$PLATFORMS" >> $GITHUB_OUTPUT + echo "IS_LATEST=$IS_LATEST" >> $GITHUB_OUTPUT + echo "VOLTO_VERSION=$(cat version.txt)" >> $GITHUB_OUTPUT + + builder-image: + needs: + - meta + uses: ./.github/workflows/image-release.yml + with: + volto-version: ${{ needs.meta.outputs.VOLTO_VERSION }} + image-name: ${{ needs.meta.outputs.BASE_IMAGE_NAME }}-builder-next + dockerfile: next/Dockerfile.builder + platforms: ${{ needs.meta.outputs.PLATFORMS }} + is-latest: ${{ needs.meta.outputs.IS_LATEST == 'true' }} + secrets: + registry-username: ${{ secrets.DOCKERHUB_USERNAME }} + registry-password: ${{ secrets.DOCKERHUB_TOKEN }} + + prod-conf-image: + uses: ./.github/workflows/image-release.yml + with: + volto-version: ${{ needs.meta.outputs.VOLTO_VERSION }} + image-name: ${{ needs.meta.outputs.BASE_IMAGE_NAME }}-prod-config-next + dockerfile: next/Dockerfile.prod + platforms: ${{ needs.meta.outputs.PLATFORMS }} + is-latest: ${{ needs.meta.outputs.IS_LATEST == 'true' }} + + secrets: + registry-username: ${{ secrets.DOCKERHUB_USERNAME }} + registry-password: ${{ secrets.DOCKERHUB_TOKEN }} + needs: + - meta + + dev-image: + uses: ./.github/workflows/image-release.yml + with: + volto-version: ${{ needs.meta.outputs.VOLTO_VERSION }} + image-name: ${{ needs.meta.outputs.BASE_IMAGE_NAME }}-dev-next + dockerfile: next/Dockerfile.dev + platforms: ${{ needs.meta.outputs.PLATFORMS }} + is-latest: ${{ needs.meta.outputs.IS_LATEST == 'true' }} + secrets: + registry-username: ${{ secrets.DOCKERHUB_USERNAME }} + registry-password: ${{ secrets.DOCKERHUB_TOKEN }} + needs: + - meta + - builder-image + + plone-frontend: + uses: ./.github/workflows/image-release.yml + with: + volto-version: ${{ needs.meta.outputs.VOLTO_VERSION }} + image-name: plone/plone-frontend-next + dockerfile: next/Dockerfile + platforms: ${{ needs.meta.outputs.PLATFORMS }} + is-latest: ${{ needs.meta.outputs.IS_LATEST == 'true' }} + secrets: + registry-username: ${{ secrets.DOCKERHUB_USERNAME }} + registry-password: ${{ secrets.DOCKERHUB_TOKEN }} + needs: + - meta + - builder-image + - prod-conf-image diff --git a/Makefile b/Makefile index 9c1804b..4ebed4c 100644 --- a/Makefile +++ b/Makefile @@ -68,21 +68,41 @@ image-builder: ## Build Base Image @echo "Building $(BASE_IMAGE_NAME)-builder:$(IMAGE_TAG)" @docker buildx build . --build-arg VOLTO_VERSION=${VOLTO_VERSION} -t $(BASE_IMAGE_NAME)-builder:$(IMAGE_TAG) -f Dockerfile.builder --load +.PHONY: image-builder-next +image-builder-next: ## Build Base Image + @echo "Building $(BASE_IMAGE_NAME)-builder-next:$(IMAGE_TAG)" + @docker buildx build . --build-arg VOLTO_VERSION=${VOLTO_VERSION} -t $(BASE_IMAGE_NAME)-builder-next:$(IMAGE_TAG) -f next/Dockerfile.builder --load + .PHONY: image-dev image-dev: ## Build Dev Image @echo "Building $(BASE_IMAGE_NAME)-dev:$(IMAGE_TAG)" @docker buildx build . --build-arg VOLTO_VERSION=${VOLTO_VERSION} -t $(BASE_IMAGE_NAME)-dev:$(IMAGE_TAG) -f Dockerfile.dev --load +.PHONY: image-dev-next +image-dev-next: ## Build Dev Image + @echo "Building $(BASE_IMAGE_NAME)-dev:$(IMAGE_TAG)" + @docker buildx build . --build-arg VOLTO_VERSION=${VOLTO_VERSION} -t $(BASE_IMAGE_NAME)-dev-next:$(IMAGE_TAG) -f next/Dockerfile.dev --load + .PHONY: image-prod-config image-prod-config: ## Build Prod Image @echo "Building $(BASE_IMAGE_NAME)-prod-config:$(IMAGE_TAG)" @docker buildx build . --build-arg VOLTO_VERSION=${VOLTO_VERSION} -t $(BASE_IMAGE_NAME)-prod-config:$(IMAGE_TAG) -f Dockerfile.prod --load +.PHONY: image-prod-config-next +image-prod-config-next: ## Build Prod Image + @echo "Building $(BASE_IMAGE_NAME)-prod-config:$(IMAGE_TAG)" + @docker buildx build . --build-arg VOLTO_VERSION=${VOLTO_VERSION} -t $(BASE_IMAGE_NAME)-prod-config-next:$(IMAGE_TAG) -f next/Dockerfile.prod --load + .PHONY: image-main image-main: ## Build main image @echo "Building $(MAIN_IMAGE_NAME):$(IMAGE_TAG)" @docker buildx build . --build-arg VOLTO_VERSION=${VOLTO_VERSION} -t $(MAIN_IMAGE_NAME):$(IMAGE_TAG) -f Dockerfile --load +.PHONY: image-main-next +image-main-next: ## Build main image + @echo "Building $(MAIN_IMAGE_NAME):$(IMAGE_TAG)" + @docker buildx build . --build-arg VOLTO_VERSION=${VOLTO_VERSION} -t $(MAIN_IMAGE_NAME)-next:$(IMAGE_TAG) -f next/Dockerfile --load + .PHONY: image-nightly image-nightly: ## Build Docker Image Nightly @echo "Building $(MAIN_IMAGE_NAME):$(NIGHTLY_IMAGE_TAG)" diff --git a/next/.npmrc b/next/.npmrc new file mode 100644 index 0000000..71c6843 --- /dev/null +++ b/next/.npmrc @@ -0,0 +1,6 @@ +public-hoist-pattern[]=*eslint* +public-hoist-pattern[]=*prettier* +public-hoist-pattern[]=*stylelint* +public-hoist-pattern[]=*cypress* +public-hoist-pattern[]=*process* +public-hoist-pattern[]=*parcel* diff --git a/next/Dockerfile b/next/Dockerfile new file mode 100644 index 0000000..9b0ffb0 --- /dev/null +++ b/next/Dockerfile @@ -0,0 +1,19 @@ +# syntax=docker/dockerfile:1 +ARG VOLTO_VERSION +FROM plone/frontend-builder-next:${VOLTO_VERSION} as builder + +# Build Volto Project and then remove directories not needed for production +RUN <