diff --git a/.forgejo/workflows/build-on-commit.yml b/.forgejo/workflows/build-on-commit.yml index d6dbdf2..da4c347 100644 --- a/.forgejo/workflows/build-on-commit.yml +++ b/.forgejo/workflows/build-on-commit.yml @@ -1,11 +1,11 @@ -name: Build Docker Image on Commit +name: Build and Publish Docker Image on Tag on: push: branches: - main - tags: - - '!' # Exclude tags + schedule: + - cron: '0 0 * * *' jobs: build-and-publish: @@ -21,10 +21,14 @@ jobs: echo "REPO_HOST=$(echo "${{ github.server_url }}" | sed 's~http[s]*://~~g')" >> $GITHUB_ENV echo "REPO_PATH=${{ github.repository }}" >> $GITHUB_ENV + - name: Login to OCI registry + run: | + echo "${{ secrets.OCI_TOKEN }}" | docker login $REPO_HOST -u "${{ secrets.OCI_USER }}" --password-stdin + - name: Build and push Docker image run: | - # Build Docker image - docker build -t $REPO_HOST/$REPO_PATH:${{ github.sha }} . - - # Remove the local image to save storage - docker rmi $REPO_HOST/$REPO_PATH:${{ github.sha }} + # Build and push multi-platform Docker images + docker build -t $REPO_HOST/$REPO_PATH:latest --push . + # Tag and push latest + docker tag $REPO_HOST/$REPO_PATH:latest + docker push $REPO_HOST/$REPO_PATH:latest diff --git a/.forgejo/workflows/build-on-tag.yml b/.forgejo/workflows/build-on-tag.yml deleted file mode 100644 index 7f3f832..0000000 --- a/.forgejo/workflows/build-on-tag.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Build and Publish Docker Image on Tag - -on: - push: - tags: - - '*' - -jobs: - build-and-publish: - runs-on: docker-builder - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set REPO_VARS - id: repo-url - run: | - echo "REPO_HOST=$(echo "${{ github.server_url }}" | sed 's~http[s]*://~~g')" >> $GITHUB_ENV - echo "REPO_PATH=${{ github.repository }}" >> $GITHUB_ENV - - - name: Login to OCI registry - run: | - echo "${{ secrets.OCI_TOKEN }}" | docker login $REPO_HOST -u "${{ secrets.OCI_USER }}" --password-stdin - - - name: Build and push Docker image - run: | - TAG=${{ github.ref_name }} # Get the tag name from the context - # Build and push multi-platform Docker images - docker build -t $REPO_HOST/$REPO_PATH:$TAG --push . - # Tag and push latest - docker tag $REPO_HOST/$REPO_PATH:$TAG $REPO_HOST/$REPO_PATH:latest - docker push $REPO_HOST/$REPO_PATH:latest diff --git a/Dockerfile b/Dockerfile index 05546cf..9ff4153 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1 +1,28 @@ -FROM alpine:3.12 \ No newline at end of file +# Use Arch Linux as the base image +FROM archlinux:base-devel + +# Set environment variables for non-interactive mode +ENV DEBIAN_FRONTEND=noninteractive + +# Update the package manager and install necessary packages +RUN pacman -Syu --noconfirm git + +# Create a new user named 'user' with UID 1000 +RUN useradd -m -u 1000 user && \ + echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers + +# Switch to the new user +USER user + +# Install yay-bin AUR package +RUN git clone https://aur.archlinux.org/yay-bin.git /home/user/yay-bin && \ + cd /home/user/yay-bin && \ + makepkg -si --noconfirm && \ + cd ~ && \ + rm -rf /home/user/yay-bin + +# Install neofetch with yay +RUN yay -S --noconfirm neofetch + +# Set the default command +CMD ["neofetch"]