Build in forgejo workflow
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
This commit is contained in:
parent
e6f86b48f0
commit
3f63441383
4 changed files with 38 additions and 43 deletions
|
|
@ -1,34 +0,0 @@
|
||||||
#\!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Check if tag is provided
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
echo "Usage: $0 <tag>"
|
|
||||||
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}"
|
|
||||||
36
.forgejo/workflows/build.yml
Normal file
36
.forgejo/workflows/build.yml
Normal file
|
|
@ -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
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
FROM nginx:alpine
|
|
||||||
COPY public/ /usr/share/nginx/html/
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
@ -7,7 +7,7 @@ This is the docker-compose file needed to host this webiste:
|
||||||
```
|
```
|
||||||
services:
|
services:
|
||||||
website:
|
website:
|
||||||
image: codeberg.org/lvl0/website:latest
|
image: forge.lvl0.xyz/lvl0/lvl0-website:latest
|
||||||
container_name: lvl0-website
|
container_name: lvl0-website
|
||||||
ports:
|
ports:
|
||||||
- 5002:80
|
- 5002:80
|
||||||
|
|
@ -25,8 +25,4 @@ zola serve
|
||||||
|
|
||||||
### Docker build
|
### Docker build
|
||||||
|
|
||||||
To build a docker image after changes, use
|
Docker images are built automatically via Forgejo Actions on push to main.
|
||||||
|
|
||||||
```sh
|
|
||||||
sh .docker/build-docker.sh v0.1.0
|
|
||||||
```
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue