0
0

Modified 11ty

This commit is contained in:
Opnxng 2023-11-07 07:36:17 +08:00
parent f7f6ca8a29
commit f50e66727b
4 changed files with 735 additions and 762 deletions

View File

@ -1,72 +1,73 @@
name: 11ty name: photon
run-name: 11ty run-name: photon
env: env:
REPO_NAME: 11ty REPO_NAME: photon
REMOTE_REPO: https://github.com/11ty/eleventy.git REMOTE_REPO: https://github.com/Xyphyn/photon.git
BUILD_PLATFORM: linux/amd64 BUILD_PLATFORM: linux/arm64
on: on:
schedule: schedule:
- cron: "0 0 1 */3 *" # every 3 months - cron: "0 0 * * *" # at midnight
push: push:
paths: paths:
- '.gitea/workflows/11ty.yaml' - '.gitea/workflows/photon.yaml'
jobs: jobs:
build: build:
runs-on: runner runs-on: runner
container: container:
image: docker:cli image: docker:cli
steps: steps:
- name: Install packages - name: Install packages
run: apk --no-cache add curl git jq run: apk --no-cache add curl git jq
- name: Check latest upstream commit - name: Check latest upstream commit
run: | run: |
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1) 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) LATEST_COMMIT=$(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1)
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV" echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
echo "LATEST_COMMIT=${LATEST_COMMIT}" >> "$GITHUB_ENV" echo "LATEST_COMMIT=${LATEST_COMMIT}" >> "$GITHUB_ENV"
echo "Stored Commit: ${STORED_COMMIT}" echo "Stored Commit: ${STORED_COMMIT}"
echo "Latest Commit: ${LATEST_COMMIT}" echo "Latest Commit: ${LATEST_COMMIT}"
- name: Build and push Docker image - name: Build and push Docker image
run: | run: |
if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then
echo "Found a new commit, building new image" echo "Found a new commit, building new image"
# Install Docker Buildx # Install Docker Buildx
BUILDX_VERSION=$(wget -q -O- https://api.github.com/repos/docker/buildx/releases/latest | jq -r '.name') BUILDX_VERSION=$(wget -q -O- https://api.github.com/repos/docker/buildx/releases/latest | jq -r '.name')
wget -O /usr/bin/docker-buildx https://github.com/docker/buildx/releases/download/$BUILDX_VERSION/buildx-$BUILDX_VERSION.linux-arm64 wget -O /usr/bin/docker-buildx https://github.com/docker/buildx/releases/download/$BUILDX_VERSION/buildx-$BUILDX_VERSION.linux-arm64
chmod +x /usr/bin/docker-buildx chmod +x /usr/bin/docker-buildx
# Create and use Docker Buildx builder # Create and use Docker Buildx builder
docker-buildx create --use --name buildx docker-buildx create --use --name buildx
# Login to Package Registry # Login to Package Registry
echo "${{ secrets.TOKEN }}" | docker login git.opnxng.com -u ${{ gitea.repository_owner }} --password-stdin echo "${{ secrets.TOKEN }}" | docker login git.opnxng.com -u ${{ gitea.repository_owner }} --password-stdin
# Build and push Docker image # Build and push Docker image
mkdir temp mkdir temp
cd temp cd temp
curl -JL https://git.opnxng.com/opnxng/docker-images/raw/branch/main/dockerfiles/11ty.Dockerfile -o Dockerfile git clone ${REMOTE_REPO} .
docker-buildx build \ sed -i 's/FROM node:20/FROM node:slim/' Dockerfile # use node:slim
--platform ${BUILD_PLATFORM} \ docker-buildx build \
-t git.opnxng.com/${{ gitea.repository_owner }}/${REPO_NAME}:latest \ --platform ${BUILD_PLATFORM} \
-f ./Dockerfile \ -t git.opnxng.com/${{ gitea.repository_owner }}/${REPO_NAME}:latest \
--push . && \ -f ./Dockerfile \
curl -H prio:low -d "Built and pushed ${REPO_NAME}" https://ntfy.opnxng.com/build || \ --push . && \
curl -H tags:warning -H prio:high -d "Built and pushed ${REPO_NAME} failed!" https://ntfy.opnxng.com/build; curl -H prio:low -d "Built and pushed ${REPO_NAME}" https://ntfy.opnxng.com/build || \
# Remove Docker Buildx builder curl -H tags:warning -H prio:high -d "Built and pushed ${REPO_NAME} failed!" https://ntfy.opnxng.com/build;
docker-buildx rm buildx # Remove Docker Buildx builder
else docker-buildx rm buildx
echo "No new commit, skipped build" else
fi echo "No new commit, skipped build"
fi
- name: Update stored commit
run: | - name: Update stored commit
if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then run: |
curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}" if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1) curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}"
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV" STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1)
else echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}" else
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1) curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}"
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV" STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1)
exit 1 echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
exit 1
fi fi

1322
LICENSE

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
# Docker images used on [Opnxng.com](https://about.opnxng.com) # Docker images used on Opnxng
If there's no suitable upstream image, we build and host one on this repo. Most images are built for our ARM64 servers. But others are free to use them. If there's no suitable upstream image, we build and host one on this repo. Most images are built for our ARM64 servers. But others are free to use them.
@ -25,8 +25,8 @@ Source | Image
[lolcat/4get](https://git.lolcat.ca/lolcat/4get) | opnxng/4get [lolcat/4get](https://git.lolcat.ca/lolcat/4get) | opnxng/4get
[ThePenguinDev/proxigram](https://codeberg.org/ThePenguinDev/proxigram) | opnxng/proxigram [ThePenguinDev/proxigram](https://codeberg.org/ThePenguinDev/proxigram) | opnxng/proxigram
[Bing Chilling/Rat Aint Tieba](https://0xacab.org/johnxina/rat) | opnxng/rat-aint-tieba [Bing Chilling/Rat Aint Tieba](https://0xacab.org/johnxina/rat) | opnxng/rat-aint-tieba
[11ty/eleventy](https://github.com/11ty/eleventy) | opnxng/11ty
[ansible/ansible](https://github.com/ansible/ansible) | opnxng/ansible [ansible/ansible](https://github.com/ansible/ansible) | opnxng/ansible
[Xyphyn/photon](https://github.com/Xyphyn/photon) | opnxng/photon [(temporary)](https://github.com/Xyphyn/photon/issues/180)
[zyachel/quetre](https://github.com/zyachel/quetre) | [pussthecatorg/quetre](https://quay.io/repository/pussthecatorg/quetre?tab=tags&tag=latest) [zyachel/quetre](https://github.com/zyachel/quetre) | [pussthecatorg/quetre](https://quay.io/repository/pussthecatorg/quetre?tab=tags&tag=latest)
[zyachel/libremdb](https://github.com/zyachel/libremdb) | [pussthecatorg/libremdb](https://quay.io/repository/pussthecatorg/libremdb?tab=tags&tag=latest) [zyachel/libremdb](https://github.com/zyachel/libremdb) | [pussthecatorg/libremdb](https://quay.io/repository/pussthecatorg/libremdb?tab=tags&tag=latest)
[cadence/breezewiki](https://gitdab.com/cadence/breezewiki) | [pussthecatorg/breezewiki](https://quay.io/repository/pussthecatorg/breezewiki?tab=tags&tag=latest) [cadence/breezewiki](https://gitdab.com/cadence/breezewiki) | [pussthecatorg/breezewiki](https://quay.io/repository/pussthecatorg/breezewiki?tab=tags&tag=latest)
@ -42,7 +42,6 @@ Source | Image
[libreddit/libreddit](https://github.com/libreddit/libreddit) | libreddit/libreddit [libreddit/libreddit](https://github.com/libreddit/libreddit) | libreddit/libreddit
[aeharding/voyager](https://github.com/aeharding/voyager) | aeharding/voyager [aeharding/voyager](https://github.com/aeharding/voyager) | aeharding/voyager
[rystaf/mlmym](https://github.com/rystaf/mlmym) | rystaf/mlmym [rystaf/mlmym](https://github.com/rystaf/mlmym) | rystaf/mlmym
[Xyphyn/photon](https://github.com/Xyphyn/photon) | xyphyn/photon
[Ahwxorg/Binternet](https://github.com/Ahwxorg/binternet/) | ahwxorg/binternet [Ahwxorg/Binternet](https://github.com/Ahwxorg/binternet/) | ahwxorg/binternet
[gothub/gothub](https://codeberg.org/gothub/gothub) | gothub/gothub [gothub/gothub](https://codeberg.org/gothub/gothub) | gothub/gothub
[go-gitea/gitea](https://github.com/go-gitea/gitea) | gitea/gitea (with [Rainnny7/gitea-github-theme](https://github.com/Rainnny7/gitea-github-theme)) [go-gitea/gitea](https://github.com/go-gitea/gitea) | gitea/gitea (with [Rainnny7/gitea-github-theme](https://github.com/Rainnny7/gitea-github-theme))

View File

@ -1,27 +0,0 @@
FROM node:lts-alpine
# Install Git
RUN apk --no-cache add git
# Set the working directory
WORKDIR /app
# Git clone the source code
RUN git clone https://github.com/11ty/eleventy.git .
# Remove Git
RUN apk del git
# Install 11ty with plugins
RUN npm install --no-save -g @11ty/eleventy \
luxon \
html-minifier \
clean-css \
markdown-it-attrs \
markdown-it-bracketed-spans \
markdown-it-eleventy-img \
@11ty/eleventy-navigation && \
rm -rf ~/.npm
# Start the application
CMD [ "npm", "start" ]