-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate ghcr.io/plone/quanta image with storybook
- Loading branch information
Showing
6 changed files
with
260 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.git | ||
.github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Build Docker Image | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
env: | ||
IMAGE_NAME: ghcr.io/plone/quanta | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ env.IMAGE_NAME }} | ||
labels: | | ||
org.label-schema.docker.cmd=docker run -d -p 80:80 ${{ env.IMAGE_NAME }}:latest | ||
flavor: | ||
latest=false | ||
tags: | | ||
type=ref,event=branch | ||
type=sha | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
platforms: linux/amd64 | ||
context: . | ||
file: Dockerfile | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: $${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM node:14-slim as base | ||
RUN <<EOT | ||
set -e | ||
apt update | ||
apt install -y --no-install-recommends python3 unzip curl build-essential git ca-certificates | ||
mkdir /app | ||
chown -R node:node /app | ||
rm -rf /var/lib/apt/lists/* | ||
EOT | ||
|
||
FROM base as builder-site | ||
|
||
WORKDIR /app | ||
USER node | ||
ENV PYTHON=python3 | ||
|
||
COPY --chown=node:node . /app/ | ||
|
||
RUN <<EOT | ||
set -e | ||
yarn | ||
yarn build-storybook -o build | ||
EOT | ||
|
||
|
||
FROM caddy:2.7-alpine | ||
|
||
LABEL maintainer="Plone Foundation <info@plone.org>" \ | ||
org.label-schema.name="quanta" \ | ||
org.label-schema.description="Quanta Public Site" \ | ||
org.label-schema.vendor="kitconcept GmbH" | ||
|
||
COPY --from=builder-site /app/build/ /usr/share/caddy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Defensive settings for make: | ||
# https://tech.davis-hansson.com/p/make/ | ||
SHELL:=bash | ||
.ONESHELL: | ||
.SHELLFLAGS:=-xeu -o pipefail -O inherit_errexit -c | ||
.SILENT: | ||
.DELETE_ON_ERROR: | ||
MAKEFLAGS+=--warn-undefined-variables | ||
MAKEFLAGS+=--no-builtin-rules | ||
|
||
IMAGE_NAME=ghcr.io/plone/quanta | ||
IMAGE_TAG=latest | ||
|
||
# We like colors | ||
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects | ||
RED=`tput setaf 1` | ||
GREEN=`tput setaf 2` | ||
RESET=`tput sgr0` | ||
YELLOW=`tput setaf 3` | ||
|
||
.PHONY: build-image | ||
build-image: ## Build Site Image | ||
@echo "Building $(IMAGE_NAME):$(IMAGE_TAG)" | ||
@docker buildx build . --progress=plain -t $(IMAGE_NAME):$(IMAGE_TAG) -f Dockerfile --load | ||
|
||
.PHONY: run-image | ||
run-image: ## Run Site Image | ||
@echo "Running $(IMAGE_NAME):$(IMAGE_TAG) on port 8080" | ||
@docker run -it -p 8080:80 $(IMAGE_NAME):$(IMAGE_TAG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters