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

First implementation #1

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
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
20 changes: 12 additions & 8 deletions .github/workflows/image-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ on:
jobs:

release:
runs-on: [self-hosted, ARM64, stable]
runs-on: ubuntu-latest
environment: DOCKER_HUB
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
${{ inputs.image-name }}
Expand All @@ -58,19 +61,20 @@ jobs:
type=raw,value=${{ inputs.volto-version }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.registry-username }}
password: ${{ secrets.registry-password }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
platforms: ${{ inputs.platforms }}
context: .
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ on:
jobs:

release:
runs-on: [self-hosted, ARM64, stable]
runs-on: ubuntu-latest
environment: DOCKER_HUB

permissions:
contents: read
packages: write
steps:

- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
Expand All @@ -33,19 +35,20 @@ jobs:
type=schedule,pattern=nightly-{{date 'YYYYMMDD'}}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.4.1
uses: docker/setup-buildx-action@v3.4.1

- name: Login to DockerHub
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Release new Docker image

on:
push:
tags:
- 'v*'
branches:
- newapproach
workflow_dispatch:

env:
BASE_IMAGE_NAME: plone/frontend
BASE_IMAGE_NAME: ghcr.io/kitconcept/frontend
PLATFORMS: linux/amd64,linux/arm64
IS_LATEST: false

Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
uses: ./.github/workflows/image-release.yml
with:
volto-version: ${{ needs.meta.outputs.VOLTO_VERSION }}
image-name: plone/plone-frontend
image-name: ghcr.io/kitconcept/plone-frontend
dockerfile: Dockerfile
platforms: ${{ needs.meta.outputs.PLATFORMS }}
is-latest: ${{ needs.meta.outputs.IS_LATEST == 'true' }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/runnertest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
Expand All @@ -29,10 +29,10 @@ jobs:
type=raw,value=buildtest

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
Expand All @@ -41,7 +41,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
Expand Down
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# syntax=docker/dockerfile:1
ARG VOLTO_VERSION
FROM plone/frontend-builder:${VOLTO_VERSION} as builder
FROM ghcr.io/kitconcept/frontend-builder:${VOLTO_VERSION} as builder

# Build Volto Project and then remove directories not needed for production
RUN <<EOT
set -e
yarn build
rm -rf cache omelette .yarn/cache
COPY pnpm-workspace.yaml /app/
RUN --mount=type=cache,id=pnpm,target=/app/.pnpm-store,uid=1000 <<EOT
pnpm build
rm -rf node_modules
pnpm install --prod
EOT
sneridagh marked this conversation as resolved.
Show resolved Hide resolved

FROM plone/frontend-prod-config:${VOLTO_VERSION} as base
FROM ghcr.io/kitconcept/frontend-prod-config:${VOLTO_VERSION} as base

LABEL maintainer="Plone Community <[email protected]>" \
org.label-schema.name="plone-frontend" \
Expand Down
34 changes: 16 additions & 18 deletions Dockerfile.builder
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# syntax=docker/dockerfile:1
FROM node:20-slim
ARG VOLTO_VERSION
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

LABEL maintainer="Plone Community <[email protected]>" \
org.label-schema.name="frontend-base" \
Expand All @@ -10,28 +12,24 @@ LABEL maintainer="Plone Community <[email protected]>" \
RUN <<EOT
set -e
apt update
apt install -y --no-install-recommends python3 build-essential git ca-certificates
npm install --no-audit --no-fund -g yo @plone/generator-volto@alpha
mkdir /app
chown -R node:node /app
apt install -y --no-install-recommends python3 python3-pip build-essential git ca-certificates pipx
rm -rf /var/lib/apt/lists/*
EOT

WORKDIR /app
RUN corepack enable
RUN <<EOT
pipx run --no-cache cookieplone sub/frontend_project --no_input __version_plone_volto=$VOLTO_VERSION
chown -R node:node /app
EOT

COPY --chown=node:node volto.config.js /app/

RUN corepack enable
USER node
RUN <<EOT

WORKDIR /app

RUN --mount=type=cache,id=pnpm,target=/app/.pnpm-store,uid=1000 <<EOT
set -e
yo @plone/volto \
app \
--description "Plone frontend using Volto" \
--skip-addons \
--skip-install \
--skip-workspaces \
--volto=${VOLTO_VERSION} \
--no-interactive
yarn install --network-timeout 1000000
git clone -b $VOLTO_VERSION --depth 1 https://github.com/plone/volto core
pnpm install
EOT

COPY --chown=node:node scripts/helper.py /setupAddon
4 changes: 2 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
ARG VOLTO_VERSION
FROM plone/frontend-builder:${VOLTO_VERSION}
FROM ghcr.io/kitconcept/frontend-builder:${VOLTO_VERSION}

LABEL maintainer="Plone Community <[email protected]>" \
org.label-schema.name="frontend-dev" \
Expand All @@ -13,7 +13,7 @@ WORKDIR /app
EXPOSE 3000 3001 6006

# Entrypoint would be yarn
ENTRYPOINT [ "yarn" ]
ENTRYPOINT [ "pnpm" ]

# Run the project in development mode
CMD ["start"]
4 changes: 2 additions & 2 deletions Dockerfile.nightly
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM node:18-slim as base
FROM node:20-slim as base
FROM base as builder


Expand Down Expand Up @@ -27,7 +27,7 @@ RUN <<EOT
rm -rf cache omelette .yarn/cache
EOT

FROM plone/frontend-prod-config:latest
FROM ghcr.io/kitconcept/frontend-prod-config:latest

LABEL maintainer="Plone Community <[email protected]>" \
org.label-schema.name="plone-frontend" \
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM node:18-slim
FROM node:20-slim

LABEL maintainer="Plone Community <[email protected]>" \
org.label-schema.name="frontend-prod-config" \
Expand All @@ -9,7 +9,7 @@ LABEL maintainer="Plone Community <[email protected]>" \

# Install busybox and wget
RUN <<EOT
set -e
set -e
apt update
apt install -y --no-install-recommends busybox wget git
busybox --install -s
Expand All @@ -18,20 +18,23 @@ RUN <<EOT
chown -R node:node /app
EOT

RUN corepack enable

# Run the image with user node
USER node

# Set working directory to /app
WORKDIR /app
RUN corepack use pnpm@9

# Expose default Express port
EXPOSE 3000

# Set healthcheck to port 3000
HEALTHCHECK --interval=10s --timeout=5s --start-period=30s CMD [ -n "$LISTEN_PORT" ] || LISTEN_PORT=3000 ; wget -q http://127.0.0.1:"$LISTEN_PORT" -O - || exit 1

# Entrypoint would be yarn
ENTRYPOINT [ "yarn" ]
# Entrypoint would be pnpm
ENTRYPOINT [ "pnpm" ]

# And the image will run in production mode
CMD ["start:prod"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ RESET=`tput sgr0`
YELLOW=`tput setaf 3`

# Current version
MAIN_IMAGE_NAME=plone/plone-frontend
BASE_IMAGE_NAME=plone/frontend
MAIN_IMAGE_NAME=ghcr.io/kitconcept/plone-frontend
BASE_IMAGE_NAME=ghcr.io/kitconcept/frontend
VOLTO_VERSION=$$(cat version.txt)
IMAGE_TAG=${VOLTO_VERSION}
NIGHTLY_IMAGE_TAG=nightly
Expand Down
10 changes: 10 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
packages:
# all packages in direct subdirs of packages/
- 'core/packages/volto'
- 'core/packages/types'
- 'core/packages/registry'
- 'core/packages/scripts'
- 'core/packages/tsconfig'
- 'core/packages/volto-slate'
- 'core/packages/coresandbox'
- 'packages/*'
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.0.0-alpha.27
18.0.0-alpha.42
7 changes: 7 additions & 0 deletions volto.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const addons = [];
const theme = "";

module.exports = {
addons,
theme,
};