Merge branch 'feature/workflow' into dev
Some checks failed
Build Docker Image / Docker-Build (push) Failing after 0s
Some checks failed
Build Docker Image / Docker-Build (push) Failing after 0s
This commit is contained in:
52
.gitea/workflows/docker.yaml
Normal file
52
.gitea/workflows/docker.yaml
Normal file
@@ -0,0 +1,52 @@
|
||||
name: Build Docker Image
|
||||
run-name: ${{ gitea.actor }} building ${{ gitea.ref_name }}
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
Docker-Build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build docker image
|
||||
run: |
|
||||
docker build -t umbrella .
|
||||
docker tag umbrella ${{ secrets.REGISTRY_PATH }}/umbrella:${{ gitea.ref_name }}
|
||||
|
||||
- name: Login to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ secrets.REGISTRY_PATH }}
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASS }}
|
||||
|
||||
- name: Re-tag the most recent image
|
||||
- run: |
|
||||
REGISTRY="${{ secrets.REGISTRY_PATH }}"
|
||||
REPO="umbrella"
|
||||
USER="${{ secrets.DOCKER_USERNAME }}"
|
||||
PASS="${{ secrets.DOCKER_PASSWORD }}"
|
||||
LATEST="${{ gitea.ref_name }}"
|
||||
NEW_TAG="${{ gitea.sha_short }}"
|
||||
|
||||
# Get auth token (basic auth for most self-hosted registries)
|
||||
TOKEN=$(curl -s -u "$USER:$PASS" "https://$REGISTRY/v2/token?service=$REGISTRY&scope=repository:$REPO:pull,push")
|
||||
AUTH="Bearer $(echo $TOKEN | jq -r .token)"
|
||||
|
||||
# Fetch latest manifest (specify mediaType header for OCI support)
|
||||
MANIFEST=$(curl -s -H "Authorization: $AUTH" -H "Accept: application/vnd.docker.distribution.manifest.v2+json,application/vnd.oci.image.manifest.v1+json" "https://$REGISTRY/v2/$REPO/manifests/$LATEST" | jq -c .)
|
||||
|
||||
# PUT manifest under new tag
|
||||
curl -X PUT -s -H "Authorization: $AUTH" -H "Content-Type: application/vnd.docker.distribution.manifest.v2+json" --data "$MANIFEST" "https://$REGISTRY/v2/$REPO/manifests/$NEW_TAG"
|
||||
|
||||
echo "Tagged $REGISTRY/$REPO:$LATEST -> $NEW_TAG"
|
||||
|
||||
- name: Push to registry
|
||||
# if: startsWith(gitea.ref, 'refs/tags/')
|
||||
run: |
|
||||
docker push ${{ secrets.REGISTRY_PATH }}/umbrella:${{ gitea.ref_name }}
|
||||
36
Dockerfile
Normal file
36
Dockerfile
Normal file
@@ -0,0 +1,36 @@
|
||||
FROM alpine:3.22 AS svelte_build
|
||||
RUN apk add bash git npm
|
||||
RUN adduser -Dh /home/svelte svelte
|
||||
ADD . /home/svelte/Umbrella
|
||||
RUN chown -R svelte /home/svelte/Umbrella
|
||||
USER svelte
|
||||
WORKDIR /home/svelte/Umbrella/frontend
|
||||
RUN npm install && npm run build
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
FROM alpine AS java_build
|
||||
RUN apk add bash git gradle fontconfig font-opensans openjdk21-jre
|
||||
ADD . /Umbrella
|
||||
WORKDIR /Umbrella
|
||||
COPY --from=svelte_build /home/svelte/Umbrella/frontend/dist web/src/main/resources/web
|
||||
RUN gradle --no-daemon build
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
FROM alpine
|
||||
RUN apk add bash fontconfig font-opensans graphviz openjdk21-jre weasyprint
|
||||
RUN adduser -D umbrella
|
||||
COPY --from=java_build /Umbrella/backend/build/libs/backend.jar /home/umbrella/jar/
|
||||
RUN chown -R umbrella /home/umbrella
|
||||
ADD https://github.com/plantuml/plantuml/releases/download/v1.2025.10/plantuml-1.2025.10.jar /home/umbrella/plantuml.jar
|
||||
USER umbrella
|
||||
WORKDIR /home/umbrella
|
||||
RUN mkdir .config && ln -s /host/config.json .config/Umbrella.json
|
||||
EXPOSE 80
|
||||
CMD java -jar jar/backend.jar
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
<script type="module" src="/src/main.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user