Compare commits
4 Commits
13bf2553d5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
c075fec647
|
|||
|
e667bd2c3d
|
|||
|
4c257cb1fb
|
|||
|
d1d96fa8ad
|
50
.gitea/workflows/build-and-push.yaml
Normal file
50
.gitea/workflows/build-and-push.yaml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main # Trigger on push to the main branch; adjust as needed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest # Use a runner with Docker support
|
||||||
|
container: ghcr.io/catthehacker/ubuntu:act-latest # Image with Docker pre-installed
|
||||||
|
outputs:
|
||||||
|
sha_short: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
steps:
|
||||||
|
# Checkout the repository code
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Set outputs
|
||||||
|
id: vars
|
||||||
|
run: |
|
||||||
|
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Set up Docker Buildx for building the image
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
driver: remote
|
||||||
|
endpoint: 'tcp://buildkitd:1234'
|
||||||
|
|
||||||
|
# Log in to the Gitea container registry
|
||||||
|
- name: Log in to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.dubyatp.xyz
|
||||||
|
username: actions
|
||||||
|
password: ${{ secrets.ACTIONS_TOKEN }} # Personal Access Token for authentication
|
||||||
|
|
||||||
|
# Build and push the Docker image
|
||||||
|
- name: Build and Push Docker Image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: . # Build context (current directory)
|
||||||
|
file: ./Dockerfile # Path to Dockerfile
|
||||||
|
platforms: "linux/amd64,linux/arm64"
|
||||||
|
push: true # Push to registry after building
|
||||||
|
tags: |
|
||||||
|
git.dubyatp.xyz/williamp/kube-zap2xml:latest
|
||||||
|
git.dubyatp.xyz/williamp/kube-zap2xml:${{steps.vars.outputs.sha_short }}
|
||||||
|
# Tags the image with 'latest' and the commit SHA
|
||||||
@@ -9,11 +9,13 @@ RUN npm ci
|
|||||||
|
|
||||||
COPY tsconfig.json tsconfig.json
|
COPY tsconfig.json tsconfig.json
|
||||||
COPY rollup.config.ts rollup.config.ts
|
COPY rollup.config.ts rollup.config.ts
|
||||||
COPY entrypoint.sh entrypoint.sh
|
COPY entrypoint-job.sh entrypoint.sh
|
||||||
COPY src/ src/
|
COPY src/ src/
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
RUN ls -l /app
|
RUN ls -l /app
|
||||||
|
|
||||||
|
RUN apk add s3cmd
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/sh", "-c", "/app/entrypoint.sh"]
|
ENTRYPOINT ["/bin/sh", "-c", "/app/entrypoint.sh"]
|
||||||
|
|||||||
16
entrypoint-job.sh
Executable file
16
entrypoint-job.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Running zap2xml"
|
||||||
|
node dist/index.js
|
||||||
|
|
||||||
|
echo "Checking if xmltv file exists"
|
||||||
|
if test -e "$OUTPUT_FILE"; then
|
||||||
|
echo "Attempting to upload to S3"
|
||||||
|
s3cmd put $OUTPUT_FILE "$S3_URL/$PUBLIC_FILENAME"
|
||||||
|
echo "Setting file to public"
|
||||||
|
s3cmd setacl "$S3_URL/$PUBLIC_FILENAME" --acl-public
|
||||||
|
else
|
||||||
|
echo "File not found, exiting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user