Merge pull request 'add pipline' (#1) from dev into main

Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2026-04-26 19:50:55 +00:00
2 changed files with 130 additions and 25 deletions
+78
View File
@@ -0,0 +1,78 @@
name: Build docker image and push to test
run-name: Build Docker and Push
on:
pull_request:
branches:
- main
jobs:
build_image_push:
runs-on: gitea_runner
name: Build binaries, Build docker image, Apply on test
env:
REGISTRY_ADDRESS: registry.ma-al.pl
DOCKER_APP_NAME: cl-project
MAAL_REGISTRY_USER: ${{ secrets.MAAL_REGISTRY_USER }}
MAAL_REGISTRY_PASSWORD: ${{ secrets.MAAL_REGISTRY_PASSWORD }}
MAAL_SSH_PRIVATE_KEY: ${{ secrets.MAAL_SSH_PRIVATE_KEY }}
steps:
- name: Pull Git Repo with Code
uses: actions/checkout@v4
- name: Generate version
run: |
VERSION=$(date +%Y%d%m_%H%M)
GIT_SHA=$(git rev-parse --short HEAD)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "GIT_SHA=$GIT_SHA" >> $GITHUB_ENV
echo "Version: $VERSION Commit:$GIT_SHA" > public/VERSION
- name: Login to registry
run: |
echo "${{ secrets.MAAL_REGISTRY_PASSWORD }}" | docker login registry.ma-al.pl \
-u "${{ secrets.MAAL_REGISTRY_USER }}" \
--password-stdin
- name: Build application image
run: |
cat <<EOF > temp.Dockerfile
FROM oven/bun:1
WORKDIR /app
COPY . /app
RUN bun install --frozen-lockfile
USER bun
EXPOSE 3000
ENTRYPOINT ["bun", "./src/server.js"]
EOF
docker build \
-t "${{ env.REGISTRY_ADDRESS }}/${{ env.DOCKER_APP_NAME }}:${{ env.VERSION }}" \
-t "${{ env.REGISTRY_ADDRESS }}/${{ env.DOCKER_APP_NAME }}:latest" \
-f temp.Dockerfile .
rm temp.Dockerfile
- name: Push image
run: |
docker push "${{ env.REGISTRY_ADDRESS }}/${{ env.DOCKER_APP_NAME }}:${{ env.VERSION }}"
docker push "${{ env.REGISTRY_ADDRESS }}/${{ env.DOCKER_APP_NAME }}:latest"
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ env.MAAL_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan 192.168.220.30 >> ~/.ssh/known_hosts
- name: Execute Remote Command
run: |
echo "Deploying version: ${{ env.VERSION }}"
ssh docker@192.168.220.30 \
"docker compose -f /volume/docker/sys/portainer/compose/71/docker-compose.yml -p mwingz_ma-al_pl pull && \
docker compose -f /volume/docker/sys/portainer/compose/71/docker-compose.yml -p mwingz_ma-al_pl up -d"
+27
View File
@@ -71,6 +71,15 @@
<a href="/api-docs" target="_blank" class="btn btn-outline-secondary btn-sm">View docs</a>
</div>
</div>
<!-- Version info -->
<div class="card mt-3">
<div class="card-body">
<div id="versionInfo" class="text-center text-muted small">
Loading version...
</div>
</div>
</div>
</main>
<script>
@@ -87,6 +96,24 @@
location.reload();
});
})();
// Fetch and display version
fetch('/VERSION')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.text();
})
.then(versionText => {
const versionInfo = document.getElementById('versionInfo');
versionInfo.textContent = versionText.trim() || 'Version not available';
})
.catch(error => {
console.error('Could not load version:', error);
const versionInfo = document.getElementById('versionInfo');
versionInfo.textContent = 'Version not available';
});
</script>
</body>
</html>