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 1 commit
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
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ FROM plone/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
set -e
pnpm build
EOT
sneridagh marked this conversation as resolved.
Show resolved Hide resolved

FROM plone/frontend-prod-config:${VOLTO_VERSION} as base
Expand Down
33 changes: 17 additions & 16 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,27 @@ 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
npm install --no-audit --no-fund -g mrs-developer
rm -rf /var/lib/apt/lists/*
pipx run cookiecutter gh:plone/cookiecutter-volto addon_name=app --no-input
davisagli marked this conversation as resolved.
Show resolved Hide resolved
chown -R node:node /app
EOT

WORKDIR /app
RUN corepack enable
COPY --chown=node:node volto.config.js /app/.

RUN corepack enable
USER node

WORKDIR /app

RUN <<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
sed -i 's/${VOLTO_VERSION}/'"$VOLTO_VERSION"'/g' mrs.developer.json
# Removes the addon dependency from package.json
python3 -c "import json; data = json.load(open('package.json')); data['dependencies'].pop(list(data['dependencies'].keys())[-1]); json.dump(data, open('package.json', 'w'), indent=2)"
rm -rf packages/app
davisagli marked this conversation as resolved.
Show resolved Hide resolved
make install
davisagli marked this conversation as resolved.
Show resolved Hide resolved
EOT

COPY --chown=node:node scripts/helper.py /setupAddon
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
10 changes: 6 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,6 +18,8 @@ RUN <<EOT
chown -R node:node /app
EOT

RUN corepack enable

# Run the image with user node
USER node

Expand All @@ -30,8 +32,8 @@ 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"]
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,
};