From 0aa9dffd7542be4a6b636867867d99326e6e200d Mon Sep 17 00:00:00 2001 From: Sangelo Date: Fri, 22 Mar 2024 11:19:46 +0100 Subject: [PATCH 01/19] Initial Docker Automatisation Work --- Dockerfile | 31 +++++++++++++++++++++++++++++++ build.sh | 5 +++++ docker-compose.build.yml | 10 ++++++++++ docker-compose.yml | 0 4 files changed, 46 insertions(+) create mode 100644 Dockerfile create mode 100755 build.sh create mode 100644 docker-compose.build.yml create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8296734 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# Builder stage +FROM node:20-alpine AS builder + +# Set the working directory in the container +WORKDIR /app + +# Copy the repository contents into the container +COPY . . + +# Install dependencies and build the site. Output directory will be /app/build +RUN yarn install && yarn run build + +# No need to move /app/build here + +# Final stage +FROM caddy:2-alpine + +# Set the working directory in the container +WORKDIR /web + +# Copy the build directory from the builder stage to /web +COPY --from=builder /app/build /web + +# Caddyfile configuration to serve files from /web +RUN echo -e ":80 {\n root * /web\n file_server\n}" > /etc/caddy/Caddyfile + +# Expose port 80 +EXPOSE 80 + +# Start Caddy with the specified Caddyfile +CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..30bb601 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +sudo docker compose -f docker-compose.build.yml down && \ +#sudo docker compose -f docker-compose.build.yml rm --all && \ +sudo docker compose -f docker-compose.build.yml build --no-cache && \ +sudo docker compose -f docker-compose.build.yml up -d --force-recreate && \ +watch -n 1 sudo docker compose -f docker-compose.build.yml ps diff --git a/docker-compose.build.yml b/docker-compose.build.yml new file mode 100644 index 0000000..0fb6a7f --- /dev/null +++ b/docker-compose.build.yml @@ -0,0 +1,10 @@ +version: '3.8' + +services: + web: + build: + context: . + dockerfile: Dockerfile + no_cache: true + ports: + - "3000:80" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e69de29 -- 2.39.2 From 34ebf48f0bebd5f2f1a1434317e61aeaf50eb2a5 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Fri, 22 Mar 2024 13:03:42 +0100 Subject: [PATCH 02/19] Specify Licenses in more detail --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 47e4f2c..59ac201 100644 --- a/README.md +++ b/README.md @@ -33,4 +33,6 @@ You can preview the production build with `yarn run preview`. ## License -You can view this project's license [here](./LICENSE). +You can view this project's source code license [here](./LICENSE). + +All assets created by me are Copyright (c) 2019-2024 Sangelo unless otherwise stated. -- 2.39.2 From ebaa9d578365d6a857a12b0adc5ffe88b51b2d5e Mon Sep 17 00:00:00 2001 From: Sangelo Date: Tue, 26 Mar 2024 13:57:52 +0100 Subject: [PATCH 03/19] [a] add podman build script --- build-podman.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 build-podman.sh diff --git a/build-podman.sh b/build-podman.sh new file mode 100755 index 0000000..2807101 --- /dev/null +++ b/build-podman.sh @@ -0,0 +1,5 @@ +podman compose -f docker-compose.build.yml down && \ +#podman compose -f docker-compose.build.yml rm --all && \ +podman compose -f docker-compose.build.yml build --no-cache && \ +podman compose -f docker-compose.build.yml up -d --force-recreate && \ +watch -n 1 podman compose -f docker-compose.build.yml ps -- 2.39.2 From df92de60da2b2e8fff9ba063e08adad85392e2f6 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Tue, 2 Apr 2024 17:42:33 +0200 Subject: [PATCH 04/19] [a] Initial Justfile build script --- Justfile | 84 ++++++++++++++++++++++++++++++++++++++++ README.md | 36 ++++++++++++++++- docker-compose.build.yml | 3 +- 3 files changed, 119 insertions(+), 4 deletions(-) create mode 100644 Justfile diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..4334a5f --- /dev/null +++ b/Justfile @@ -0,0 +1,84 @@ +# settings +set dotenv-load + +# defaults +default_runner := 'docker' +default_tag := 'latest' +default_image := 'gitpot.dev/sangelo/website:latest' + +# run development server by default +default: dev + +# aliases +alias c := clean +alias b := build +alias r := run +alias d := dev +alias p := preview + +# building + +# run all docker related recipes (clean, build, run) (default runner: docker) +all tag=default_tag runner=default_runner: + just -f {{justfile()}} clean {{runner}} {{tag}} + just -f {{justfile()}} build {{tag}} {{runner}} + just -f {{justfile()}} run {{tag}} {{runner}} + +# clean containers, images and temporary svelte dirs with specified runner (default runner: docker) +clean runner=default_runner tag=default_tag: + @echo "Cleaning dev environment..." + rm -rf build/ .svelte-kit/ + @echo "Cleaning containers with '{{runner}}'..." + TAG="{{tag}}" {{runner}} compose -f docker-compose.build.yml down + @echo "Cleaning images with '{{runner}}'..." + just -f {{justfile()}} _clean_images {{runner}} + +# clean images function +_clean_images runner=default_runner: + #!/usr/bin/env bash + set -euo pipefail + image_ids=$({{runner}} image ls | grep gitpot.dev/sangelo/website | awk '{print $3}') + if [ -n "$image_ids" ]; then + for image_id in $image_ids; do + {{runner}} image rm $image_id + echo "Image with ID $image_id deleted successfully." + done + else + echo "No images matching the repository and tag found." + fi + +# build container image with specified runner (default runner: docker) +build tag=default_tag runner=default_runner: + @echo "Running with '{{runner}}' and tagging as '{{tag}}'..." + TAG="{{tag}}" {{runner}} compose -f docker-compose.build.yml build --no-cache + +# run container image with specified runner (default runner: docker) +run tag=default_tag runner=default_runner: + @echo "Running with '{{runner}}'..." + {{runner}} compose -f docker-compose.build.yml up -d --force-recreate + @# watch -n 1 {{runner}} compose -f docker-compose.build.yml ps + +publish image=default_image runner=default_runner: + @echo "Publishing with '{{runner}}'..." + @# log into gitpot + {{runner}} login gitpot.dev -u $GITPOT_USERNAME -p $GITPOT_PASSWORD + @# push the specified image to the container registry + {{runner}} push {{image}} + @echo -e "\e[1;32mPublished {{image}} successfuly! Use '{{runner}} pull {{image}}' to pull the container.\e[0m" + +# development + +# install dependencies +_install: + yarn install + +# run vite dev server +dev: _install + @echo "Running vite development server..." + yarn run dev --open + +# run vite preview server +preview: _install + @echo "Running vite preview server..." + yarn run build + yarn run preview --open diff --git a/README.md b/README.md index 59ac201..2084e2d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,23 @@ Feel free to explore! You're welcome to contribute to this website if you have a Lunivity account (see homepage for details if registrations aren't open).
Once you fork and clone the repository, follow the next steps. +If you have `just` installed, setting up is pretty easy: + +```bash +# setup dependencies and run dev server +just + +# you can also run `just dev` +just dev + +# to build and preview a webpage, run `just preview` +just preview +``` + +View a list of all possible `just` recipes with `just -l`. + +Otherwise, if you don't already have or don't want to install `just`, you can run the commands manually: + ```bash # install dependencies yarn install @@ -23,16 +40,31 @@ Once you've made your changes, you can create a Pull Request and I'll make sure ## Building -To create a production version of this website: +To create a production version of this website without docker: ```bash yarn run build ``` +To build a docker container image with `just`: + +```bash +# build and run container image with docker +just build + +# build with podman +just build podman + +# clean, build, and run container image with docker or podman +just all +just all podman +``` + You can preview the production build with `yarn run preview`. ## License You can view this project's source code license [here](./LICENSE). -All assets created by me are Copyright (c) 2019-2024 Sangelo unless otherwise stated. +All assets (images, logos, etc.) created by me (Sangelo) are Copyright (c) 2019-2024 Sangelo unless otherwise stated.
+Brand logos and icons (such as Discord, Github, YouTube, etc.) are trademarked by and copyright of their respective owners. diff --git a/docker-compose.build.yml b/docker-compose.build.yml index 0fb6a7f..60767d7 100644 --- a/docker-compose.build.yml +++ b/docker-compose.build.yml @@ -1,7 +1,6 @@ -version: '3.8' - services: web: + image: gitpot.dev/sangelo/website:${TAG} build: context: . dockerfile: Dockerfile -- 2.39.2 From 63743985447ceb7646bd4ac5669f2ad99ed46129 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Tue, 2 Apr 2024 20:25:10 +0200 Subject: [PATCH 05/19] [c] Fix Justfile errors, Dockerfile removes build image now --- Dockerfile | 5 +++-- Justfile | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8296734..161e233 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,8 +10,6 @@ COPY . . # Install dependencies and build the site. Output directory will be /app/build RUN yarn install && yarn run build -# No need to move /app/build here - # Final stage FROM caddy:2-alpine @@ -29,3 +27,6 @@ EXPOSE 80 # Start Caddy with the specified Caddyfile CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] + +# Remove intermediate images after build +ONBUILD RUN rm -rf /app diff --git a/Justfile b/Justfile index 4334a5f..5291138 100644 --- a/Justfile +++ b/Justfile @@ -36,7 +36,7 @@ clean runner=default_runner tag=default_tag: # clean images function _clean_images runner=default_runner: #!/usr/bin/env bash - set -euo pipefail + set -o pipefail image_ids=$({{runner}} image ls | grep gitpot.dev/sangelo/website | awk '{print $3}') if [ -n "$image_ids" ]; then for image_id in $image_ids; do @@ -55,7 +55,7 @@ build tag=default_tag runner=default_runner: # run container image with specified runner (default runner: docker) run tag=default_tag runner=default_runner: @echo "Running with '{{runner}}'..." - {{runner}} compose -f docker-compose.build.yml up -d --force-recreate + TAG={{tag}} {{runner}} compose -f docker-compose.build.yml up -d --force-recreate @# watch -n 1 {{runner}} compose -f docker-compose.build.yml ps publish image=default_image runner=default_runner: -- 2.39.2 From 968673e8cd979c49be193a81c1c44b2a105ab926 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Tue, 2 Apr 2024 23:18:57 +0200 Subject: [PATCH 06/19] [c] Remove broken colorisation --- Justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Justfile b/Justfile index 5291138..1f2d186 100644 --- a/Justfile +++ b/Justfile @@ -64,7 +64,7 @@ publish image=default_image runner=default_runner: {{runner}} login gitpot.dev -u $GITPOT_USERNAME -p $GITPOT_PASSWORD @# push the specified image to the container registry {{runner}} push {{image}} - @echo -e "\e[1;32mPublished {{image}} successfuly! Use '{{runner}} pull {{image}}' to pull the container.\e[0m" + @echo "Published {{image}} successfuly! Use '{{runner}} pull {{image}}' to pull the container." # development -- 2.39.2 From fb13312485d55eb5f3ec05778119929ed55ae4a9 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 11:05:16 +0200 Subject: [PATCH 07/19] [c] Update Justfile env variables for publishing --- Justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Justfile b/Justfile index 1f2d186..6266967 100644 --- a/Justfile +++ b/Justfile @@ -61,7 +61,7 @@ run tag=default_tag runner=default_runner: publish image=default_image runner=default_runner: @echo "Publishing with '{{runner}}'..." @# log into gitpot - {{runner}} login gitpot.dev -u $GITPOT_USERNAME -p $GITPOT_PASSWORD + echo "$GITPOT_TOKEN" | {{runner}} login gitpot.dev -u $GITPOT_USERNAME --password-stdin @# push the specified image to the container registry {{runner}} push {{image}} @echo "Published {{image}} successfuly! Use '{{runner}} pull {{image}}' to pull the container." -- 2.39.2 From d6243574e6cc9e625ce92910b977602a3e6d3a49 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 11:05:30 +0200 Subject: [PATCH 08/19] [a] Initial build workflow --- .forgejo/workflows/build.yml | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .forgejo/workflows/build.yml diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..051f3c7 --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,41 @@ +name: Build and push docker image + +# start workflow every time a tag/release is created +on: + push: + tags: + - '*' + +jobs: + deploy: + runs-on: ubuntu-latest + defaults: + run: + working-directory: /repo + + # build the docker container + steps: + - name: ✨ Installing just command runner + run: | + # download and extract just to /bin/just + curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /bin + just --help || echo "Error: 'just' wasn't found. Maybe the download failed?" + + - name: ⬇️ Checkout Repository + uses: actions/checkout@v4 + + - name: 🐋 Build Container + run: | + # build the container + just build ${{ github.ref }} + + - name: 🐳 Publish Container + run: | + echo "${{ secrets.PUBLISH_TOKEN }}" | docker login gitpot.dev -u sangelo --password-stdin + docker push gitpot.dev/sangelo/website:${{ github.ref }} + + # publish tag latest as well + if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then + docker tag gitpot.dev/sangelo/website:${{ github.ref }} gitpot.dev/sangelo/website:latest + docker push gitpot.dev/sangelo/website:latest + fi -- 2.39.2 From f3c9b5b9944c39ba8f2df52ce23396b539d5b60f Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 11:13:50 +0200 Subject: [PATCH 09/19] [c] Update workflow working directory --- .forgejo/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 051f3c7..e3da367 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest defaults: run: - working-directory: /repo + working-directory: /tmp # build the docker container steps: -- 2.39.2 From b697c193429c11a6079181316a5509483dd179b2 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 11:19:26 +0200 Subject: [PATCH 10/19] [c] Update Justfile Path in workflow --- .forgejo/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index e3da367..b99aece 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -27,7 +27,7 @@ jobs: - name: 🐋 Build Container run: | # build the container - just build ${{ github.ref }} + just -f /workspace/sangelo/website/Justfile build ${{ github.ref }} - name: 🐳 Publish Container run: | -- 2.39.2 From 1b8431f234e035b734af0b6b28558d2780a72d52 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 11:25:12 +0200 Subject: [PATCH 11/19] [c] force workflow to use proper image --- .forgejo/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index b99aece..6a0212c 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -9,6 +9,8 @@ on: jobs: deploy: runs-on: ubuntu-latest + container: + image: ghcr.io/catthehacker/ubuntu:act-latest defaults: run: working-directory: /tmp -- 2.39.2 From 309e066319024bf4e2389004d82776b89dd3be30 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 11:44:00 +0200 Subject: [PATCH 12/19] [c] Mount the docker socket into the container --- .forgejo/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 6a0212c..0497829 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -11,6 +11,8 @@ jobs: runs-on: ubuntu-latest container: image: ghcr.io/catthehacker/ubuntu:act-latest + volumes: + - /var/run/docker.sock:/var/run/docker.sock defaults: run: working-directory: /tmp -- 2.39.2 From e2b394a6eb6972cf990863d8f8511b5aeb01ecb0 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 12:32:42 +0200 Subject: [PATCH 13/19] [c] update tag refs to work properly --- .forgejo/workflows/build.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 0497829..10748a9 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -30,16 +30,18 @@ jobs: - name: 🐋 Build Container run: | + # extract tag name without the prefix + TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///') # build the container - just -f /workspace/sangelo/website/Justfile build ${{ github.ref }} + just -f /workspace/sangelo/website/Justfile build "${TAG}" - name: 🐳 Publish Container run: | echo "${{ secrets.PUBLISH_TOKEN }}" | docker login gitpot.dev -u sangelo --password-stdin - docker push gitpot.dev/sangelo/website:${{ github.ref }} + docker push "gitpot.dev/sangelo/website:${TAG}" # publish tag latest as well if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then - docker tag gitpot.dev/sangelo/website:${{ github.ref }} gitpot.dev/sangelo/website:latest - docker push gitpot.dev/sangelo/website:latest + docker tag "gitpot.dev/sangelo/website:${TAG}" "gitpot.dev/sangelo/website:latest" + docker push "gitpot.dev/sangelo/website:latest" fi -- 2.39.2 From 2ccdfe1550e2bfb1d14fdb792a9de86130606b76 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 12:39:23 +0200 Subject: [PATCH 14/19] [c] try fixing tag variable --- .forgejo/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 10748a9..56d80b7 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -31,7 +31,7 @@ jobs: - name: 🐋 Build Container run: | # extract tag name without the prefix - TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///') + export TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///') # build the container just -f /workspace/sangelo/website/Justfile build "${TAG}" -- 2.39.2 From 1bc627e890fc1c9620ce34a2e18278873d97c4d9 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 12:41:20 +0200 Subject: [PATCH 15/19] [c] debug workflow vars --- .forgejo/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 56d80b7..1109c93 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -34,9 +34,11 @@ jobs: export TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///') # build the container just -f /workspace/sangelo/website/Justfile build "${TAG}" + echo "$TAG" - name: 🐳 Publish Container run: | + echo "$TAG" echo "${{ secrets.PUBLISH_TOKEN }}" | docker login gitpot.dev -u sangelo --password-stdin docker push "gitpot.dev/sangelo/website:${TAG}" -- 2.39.2 From 88950724c9ef0ec438e42470d2b18ac9bfa6022e Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 12:43:07 +0200 Subject: [PATCH 16/19] [c] re-create tag var in publish container task --- .forgejo/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 1109c93..ccf9acb 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -34,11 +34,10 @@ jobs: export TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///') # build the container just -f /workspace/sangelo/website/Justfile build "${TAG}" - echo "$TAG" - name: 🐳 Publish Container run: | - echo "$TAG" + export TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///') echo "${{ secrets.PUBLISH_TOKEN }}" | docker login gitpot.dev -u sangelo --password-stdin docker push "gitpot.dev/sangelo/website:${TAG}" -- 2.39.2 From 4ecf1f1de60182d61b59f268260660e2833836ac Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 12:46:25 +0200 Subject: [PATCH 17/19] [c] modify workflow if-statement to work in SH --- .forgejo/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index ccf9acb..2025f3e 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -42,7 +42,7 @@ jobs: docker push "gitpot.dev/sangelo/website:${TAG}" # publish tag latest as well - if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then + if echo "${{ github.ref }}" | grep -q "refs/tags/"; then docker tag "gitpot.dev/sangelo/website:${TAG}" "gitpot.dev/sangelo/website:latest" docker push "gitpot.dev/sangelo/website:latest" fi -- 2.39.2 From ef5bc8a670b440445ed77f56f4a00eb947f13388 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 12:59:24 +0200 Subject: [PATCH 18/19] [c] add description label to dockerfile --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 161e233..68fe4b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,5 +28,8 @@ EXPOSE 80 # Start Caddy with the specified Caddyfile CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] +# Description for docker container +LABEL description="Sangelo's Space website, packaged as a docker container, with the Caddy webserver." + # Remove intermediate images after build ONBUILD RUN rm -rf /app -- 2.39.2 From 7e19be55b14ff14bf8a59bd8249c5560dc83298c Mon Sep 17 00:00:00 2001 From: Sangelo Date: Wed, 3 Apr 2024 13:08:42 +0200 Subject: [PATCH 19/19] [c] Update README with up-to-date just commands --- README.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2084e2d..d466751 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,6 @@ just # you can also run `just dev` just dev - -# to build and preview a webpage, run `just preview` -just preview ``` View a list of all possible `just` recipes with `just -l`. @@ -40,27 +37,40 @@ Once you've made your changes, you can create a Pull Request and I'll make sure ## Building +### Build locally + To create a production version of this website without docker: ```bash +# automatically build & preview +just preview + +# or, manually build yarn run build ``` +You can then preview the production build locally with `yarn run preview --open`. + +The files will be available in the repo, in the `build/` directory. + +### Build with Docker + To build a docker container image with `just`: ```bash -# build and run container image with docker +# build and run container image with docker, tag: latest just build # build with podman -just build podman +just build podman -# clean, build, and run container image with docker or podman +# clean, build, and run container image with docker, tag: latest just all -just all podman +# clean, build, and run container image with podman, tag: dev +just all dev podman ``` -You can preview the production build with `yarn run preview`. +You can preview the produced docker build with `just run [tag] [runner]`. ## License -- 2.39.2