0
0

Added Priviblur
All checks were successful
priviblur / build-priviblur (push) Successful in 2m10s

This commit is contained in:
Opnxng 2024-10-09 12:26:21 +08:00
parent 013d9752ff
commit 057afd36c6
2 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,65 @@
name: priviblur
run-name: priviblur
env:
REPO_NAME: priviblur
REMOTE_REPO: https://github.com/syeopite/priviblur.git
BUILD_PLATFORM: linux/arm64
on:
schedule:
- cron: "0 0 * * *" # at midnight
push:
paths:
- ".gitea/workflows/priviblur.yaml"
jobs:
build-priviblur:
runs-on: runner
container:
image: git.opnxng.com/opnxng/docker-buildx:latest
steps:
- name: Check latest upstream commit
run: |
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1)
LATEST_COMMIT=$(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1)
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
echo "LATEST_COMMIT=${LATEST_COMMIT}" >> "$GITHUB_ENV"
echo "Stored Commit: ${STORED_COMMIT}"
echo "Latest Commit: ${LATEST_COMMIT}"
- name: Build and push Docker image
run: |
if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then
echo "Found a new commit, building new image"
# Create and use Docker Buildx builder
docker buildx create --use --name buildx
# Login to Package Registry
echo "${{ secrets.TOKEN }}" | docker login git.opnxng.com -u ${{ gitea.repository_owner }} --password-stdin
# Build and push Docker image
mkdir temp
cd temp
curl -JL https://git.opnxng.com/opnxng/docker-images/raw/branch/main/dockerfiles/priviblur.Dockerfile -o Dockerfile
docker buildx build \
--platform ${BUILD_PLATFORM} \
-t git.opnxng.com/${{ gitea.repository_owner }}/${REPO_NAME}:latest \
-f ./Dockerfile \
--push . && \
curl -H prio:low -d "Built and pushed ${REPO_NAME}" https://ntfy.opnxng.com/build || \
{ curl -H tags:warning -H prio:high -d "Built and pushed ${REPO_NAME} failed!" https://ntfy.opnxng.com/build ; exit 1; }
# Remove Docker Buildx builder
docker buildx rm buildx
else
echo "No new commit, skipped build"
fi
- name: Update stored commit
run: |
if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then
curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}"
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1)
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
else
curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}"
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1)
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
exit 1
fi

View File

@ -0,0 +1,17 @@
FROM quay.io/pussthecatorg/priviblur
# Use sed to replace the colors in base.css
RUN sed -i 's/--color-primary-900: hsl(25, 100%, 15%);/--color-primary-900: hsl(210, 60%, 10%);/' ./assets/css/base.css && \
sed -i 's/--color-primary-800: hsl(27, 50%, 30%);/--color-primary-800: hsl(210, 50%, 20%);/' ./assets/css/base.css && \
sed -i 's/--color-primary-700: hsl(30, 50%, 40%);/--color-primary-700: hsl(210, 50%, 30%);/' ./assets/css/base.css && \
sed -i 's/--color-primary-600: hsl(33, 70%, 45%);/--color-primary-600: hsl(210, 50%, 40%);/' ./assets/css/base.css && \
sed -i 's/--color-primary-500: hsl(36, 80%, 50%);/--color-primary-500: hsl(210, 50%, 50%);/' ./assets/css/base.css && \
sed -i 's/--color-primary-400: hsl(36, 90%, 60%);/--color-primary-400: hsl(210, 45%, 60%);/' ./assets/css/base.css && \
sed -i 's/--color-primary-300: hsl(36, 100%, 70%);/--color-primary-300: hsl(210, 40%, 70%);/' ./assets/css/base.css && \
sed -i 's/--color-primary-200: hsl(36, 100%, 85%);/--color-primary-200: hsl(210, 30%, 80%);/' ./assets/css/base.css && \
sed -i 's/--color-primary-100: hsl(36, 100%, 95%);/--color-primary-100: hsl(210, 20%, 90%);/' ./assets/css/base.css
EXPOSE 8000
USER priviblur
ENTRYPOINT [ "/sbin/tini", "--"]
CMD [ "python", "-m", "src.server" ]