generated from oci/template
archlinux container
Some checks failed
Build and Publish Docker Image on Tag / build-and-publish (push) Failing after 2m25s
Some checks failed
Build and Publish Docker Image on Tag / build-and-publish (push) Failing after 2m25s
This commit is contained in:
parent
775a92f605
commit
58631f760d
3 changed files with 40 additions and 42 deletions
|
@ -1,11 +1,11 @@
|
||||||
name: Build Docker Image on Commit
|
name: Build and Publish Docker Image on Tag
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
tags:
|
schedule:
|
||||||
- '!' # Exclude tags
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-publish:
|
build-and-publish:
|
||||||
|
@ -21,10 +21,14 @@ jobs:
|
||||||
echo "REPO_HOST=$(echo "${{ github.server_url }}" | sed 's~http[s]*://~~g')" >> $GITHUB_ENV
|
echo "REPO_HOST=$(echo "${{ github.server_url }}" | sed 's~http[s]*://~~g')" >> $GITHUB_ENV
|
||||||
echo "REPO_PATH=${{ github.repository }}" >> $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
|
- name: Build and push Docker image
|
||||||
run: |
|
run: |
|
||||||
# Build Docker image
|
# Build and push multi-platform Docker images
|
||||||
docker build -t $REPO_HOST/$REPO_PATH:${{ github.sha }} .
|
docker build -t $REPO_HOST/$REPO_PATH:latest --push .
|
||||||
|
# Tag and push latest
|
||||||
# Remove the local image to save storage
|
docker tag $REPO_HOST/$REPO_PATH:latest
|
||||||
docker rmi $REPO_HOST/$REPO_PATH:${{ github.sha }}
|
docker push $REPO_HOST/$REPO_PATH:latest
|
||||||
|
|
|
@ -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
|
|
29
Dockerfile
29
Dockerfile
|
@ -1 +1,28 @@
|
||||||
FROM alpine:3.12
|
# 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"]
|
||||||
|
|
Loading…
Reference in a new issue