Skip to content

Commit

Permalink
ci: Push headless server image
Browse files Browse the repository at this point in the history
  • Loading branch information
TilmanGriesel committed Jan 11, 2025
1 parent c6c85fb commit 5163859
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Docker Images
on:
push:

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Determine Version and Build Number
id: version
run: |
echo "BUILD_NUM=${{ github.run_number }}" >> $GITHUB_ENV
if [ "${{ github.ref_type }}" == "tag" ]; then
echo "VERSION=${{ github.ref_name }}.${{ github.run_number }}" >> $GITHUB_ENV
else
echo "VERSION=latest" >> $GITHUB_ENV
fi
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_API_KEY }}

- name: Build and Push Web Image
run: |
docker build \
--build-arg VERSION=${{ env.VERSION }} \
--build-arg BUILD_NUM=${{ env.BUILD_NUM }} \
-t ${{ secrets.DOCKER_USERNAME }}/alpinezen-wallpaper:headless-${{ env.VERSION }} \
.
docker push ${{ secrets.DOCKER_USERNAME }}/alpinezen-wallpaper:headless-${{ env.VERSION }}
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Builder stage
FROM golang:1.22.3-alpine as builder

ARG VERSION=latest
ENV APP_VERSION=$VERSION

ARG BUILD_NUM=0
ENV APP_BUILD_NUM=$BUILD_NUM

WORKDIR /app

COPY go.mod go.sum ./
Expand All @@ -25,7 +31,6 @@ RUN mkdir -p /srv/latest_wallpaper

RUN ln -sf /root/.alpinezen_wallpaper/latest.jpg /srv/latest_wallpaper/latest.jpg

# Make the script executable
RUN chmod +x /app/entrypoint.sh

EXPOSE 80
Expand Down
2 changes: 1 addition & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Start CLI in the background
./cli --loglevel 3 --clock-disable --runtime-headless "$@" &

# Create config
# Config
cat <<EOF > /tmp/Caddyfile
:80 {
root * /srv/latest_wallpaper
Expand Down

0 comments on commit 5163859

Please sign in to comment.