diff --git a/.docker/build-docker.sh b/.docker/build-docker.sh deleted file mode 100755 index 9576728..0000000 --- a/.docker/build-docker.sh +++ /dev/null @@ -1,34 +0,0 @@ -#\!/bin/bash -set -e - -# Check if tag is provided -if [ $# -eq 0 ]; then - echo "Usage: $0 " - echo "Example: $0 v0.1.2" - exit 1 -fi - -# Configuration -REGISTRY="codeberg.org" -NAMESPACE="lvl0" -IMAGE_NAME="website" -TAG="$1" -FULL_IMAGE="${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${TAG}" - -echo "Building Docker image: ${FULL_IMAGE}" - -# Build the image -docker build -f .docker/Dockerfile -t "${FULL_IMAGE}" . - -# Also tag as latest -LATEST_IMAGE="${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest" -docker tag "${FULL_IMAGE}" "${LATEST_IMAGE}" - -echo "Image built successfully!" -echo "Tagged as: ${FULL_IMAGE}" -echo "Tagged as: ${LATEST_IMAGE}" -echo "" -echo "To push to registry, run:" -echo "docker login ${REGISTRY}" -echo "docker push ${FULL_IMAGE}" -echo "docker push ${LATEST_IMAGE}" diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..9ba3ae9 --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build and Push Docker Image +on: + push: + branches: [main] + +jobs: + build: + runs-on: docker + container: + image: node:20-bookworm + steps: + - uses: https://data.forgejo.org/actions/checkout@v4 + with: + submodules: true + + - name: Set up QEMU + uses: https://data.forgejo.org/docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: https://data.forgejo.org/docker/setup-buildx-action@v3 + + - name: Login to Forgejo Registry + uses: https://data.forgejo.org/docker/login-action@v3 + with: + registry: forge.lvl0.xyz + username: ${{ github.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and push + uses: https://data.forgejo.org/docker/build-push-action@v5 + with: + context: . + file: .docker/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: forge.lvl0.xyz/lvl0/lvl0-website:latest diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 91de387..0000000 --- a/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM nginx:alpine -COPY public/ /usr/share/nginx/html/ -EXPOSE 80 diff --git a/README.md b/README.md index 7eea17f..1f9b918 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This is the docker-compose file needed to host this webiste: ``` services: website: - image: codeberg.org/lvl0/website:latest + image: forge.lvl0.xyz/lvl0/lvl0-website:latest container_name: lvl0-website ports: - 5002:80 @@ -25,8 +25,4 @@ zola serve ### Docker build -To build a docker image after changes, use - -```sh -sh .docker/build-docker.sh v0.1.0 -``` +Docker images are built automatically via Forgejo Actions on push to main.