This commit is contained in:
@@ -30,5 +30,5 @@ jobs:
|
||||
tags: |
|
||||
${{ vars.LOCAL_REGISTRY }}/${{ gitea.repository_owner }}/website:latest
|
||||
${{ vars.LOCAL_REGISTRY }}/${{ gitea.repository_owner }}/website:${{ gitea.sha }}
|
||||
cache-from: type=gha,scope:build-${{ gitea.ref_name }}
|
||||
cache-to: type=gha,scope:build-${{ gitea.ref_name }},mode=max
|
||||
cache-from: type=registry,ref=${{ vars.LOCAL_REGISTRY }}/${{ gitea.repository_owner }}/website:buildcache
|
||||
cache-to: type=registry,ref=${{ vars.LOCAL_REGISTRY }}/${{ gitea.repository_owner
|
||||
@@ -20,9 +20,7 @@ COPY . .
|
||||
# --- Asset Generation Step ---
|
||||
RUN ls -la .
|
||||
RUN ls -la /scripts
|
||||
RUN chmod +x ./scripts/*.sh && \
|
||||
./scripts/first_page_image.sh && \
|
||||
./scripts/generate_webp.sh
|
||||
RUN chmod +x ./scripts/*.sh && ./scripts/first_page_image.sh
|
||||
|
||||
# Run the build command
|
||||
RUN pnpm run build
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/ash
|
||||
# Converts all JPG and PNG images in /public to WebP format.
|
||||
|
||||
PUBLIC_DIR="./public"
|
||||
WEBP_QUALITY=80
|
||||
|
||||
# Check if cwebp command is available
|
||||
if ! command -v cwebp &> /dev/null
|
||||
then
|
||||
echo "Error: 'cwebp' command not found. Please install the 'webp' package."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Searching for images to convert to WebP in $PUBLIC_DIR..."
|
||||
|
||||
# Find all jpg, jpeg, and png files, and ignore node_modules just in case
|
||||
find "$PUBLIC_DIR" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" \) | while read -r img_file; do
|
||||
output_webp="${img_file%.*}.webp"
|
||||
|
||||
# Only create the image if it doesn't already exist
|
||||
if [ ! -f "$output_webp" ]; then
|
||||
echo "Converting: $img_file"
|
||||
cwebp -q "$WEBP_QUALITY" "$img_file" -o "$output_webp"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo " -> Created: $output_webp"
|
||||
else
|
||||
echo " -> Error: Failed to create WebP for $img_file."
|
||||
fi
|
||||
else
|
||||
echo "Skipping: $output_webp already exists."
|
||||
fi
|
||||
done
|
||||
|
||||
echo "WebP conversion finished."
|
||||
Reference in New Issue
Block a user