-
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.
Merge pull request #5 from jumpstarter-dev/devspace
Website devspace
- Loading branch information
Showing
4 changed files
with
160 additions
and
0 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,28 @@ | ||
schemaVersion: 2.3.0 | ||
metadata: | ||
name: jumpstarter-website-dev | ||
icon: https://jumpstarter.dev/jumpstarter.svg | ||
tags: | ||
- hugo | ||
- website | ||
language: Python | ||
projects: | ||
- name: jumpstarter | ||
git: | ||
remotes: | ||
origin: https://github.com/jumpstarter-dev/website.git | ||
components: | ||
- name: runtime | ||
container: | ||
image: quay.io/jumpstarter-dev/jumpstarter-website-devspace:latest | ||
endpoints: | ||
- name: website | ||
targetPort: 1313 | ||
protocol: http | ||
mountSources: true | ||
|
||
commands: | ||
- id: serve-website | ||
exec: | ||
component: runtime | ||
commandLine: hugo serve |
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,19 @@ | ||
FROM quay.io/devfile/base-developer-image:ubi9-latest | ||
LABEL maintainer="jumpstarter.dev" | ||
|
||
LABEL name="devfile/udi9/jumpstarter-website" | ||
|
||
#labels for container catalog | ||
LABEL summary="devfile jumpstarter website developer image" | ||
LABEL description="Devspaces image for maintaining the website" | ||
LABEL io.k8s.display-name="jumpstarter-website-developer" | ||
|
||
|
||
# Install required packages | ||
USER root | ||
RUN dnf install -y nodejs npm git golang jq && dnf clean all | ||
COPY .devfile/install_hugo.sh /tmp/install_hugo.sh | ||
RUN /tmp/install_hugo.sh | ||
|
||
USER 10001 | ||
|
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,28 @@ | ||
#!/bin/sh | ||
|
||
set -ex | ||
|
||
ARCH=$(uname -m) | ||
|
||
case $ARCH in | ||
x86_64) | ||
ARCH="amd64" | ||
;; | ||
aarch64) | ||
ARCH="arm64" | ||
;; | ||
*) | ||
echo "Unsupported architecture: $ARCH" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
URL=$(curl https://api.github.com/repos/gohugoio/hugo/releases/latest -s | \ | ||
jq -r ".assets[] | select(.name | test(\"linux\")) | .browser_download_url" | \ | ||
grep .tar.gz | \ | ||
grep -v extended | \ | ||
grep "${ARCH}") | ||
|
||
echo $URL | ||
curl -L $URL | tar xvfz - -C /usr/bin hugo | ||
|
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,85 @@ | ||
name: Build and push container image | ||
on: | ||
workflow_dispatch: | ||
push: | ||
merge_group: | ||
|
||
env: | ||
PUSH: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }} | ||
REGISTRY: quay.io | ||
QUAY_ORG: quay.io/jumpstarter-dev | ||
|
||
jobs: | ||
build-and-push-image: | ||
strategy: | ||
matrix: | ||
image: | ||
- jumpstarter-dev/jumpstarter-website-devspace .devfile/Containerfile | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get image name and container file | ||
run: | | ||
IMAGE="${{ matrix.image }}" | ||
IMAGE_NAME=$(echo $IMAGE | awk '{print $1}') | ||
CONTAINERFILE=$(echo $IMAGE | awk '{print $2}') | ||
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV | ||
echo "IMAGE_NAME=${IMAGE_NAME}" | ||
echo "CONTAINERFILE=${CONTAINERFILE}" >> $GITHUB_ENV | ||
echo "CONTAINERFILE=${CONTAINERFILE}" | ||
- name: Get version | ||
run: | | ||
VERSION=$(git describe --tags) | ||
VERSION=${VERSION#v} # remove the leading v prefix for version | ||
echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
echo "VERSION=${VERSION}" | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
if: ${{ env.PUSH == 'true' }} | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: jumpstarter-dev+jumpstarter_ci | ||
password: ${{ secrets.QUAY_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ${{ env.CONTAINERFILE }} | ||
push: ${{ env.PUSH }} | ||
tags: ${{ steps.meta.outputs.tags }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
if: ${{ env.PUSH == 'true' }} | ||
with: | ||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: ${{ env.PUSH }} |