Add Dockerfile, docker-compose.yml and Gitea Actions workflow for CI/CD

This commit is contained in:
DanielS
2026-06-30 23:19:39 +02:00
parent 79745eb127
commit 54fefadda9
3 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
name: CI/CD Deployment
on:
push:
branches:
- master
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEBIAN_HOST }}
username: ${{ secrets.DEBIAN_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
cd /opt/websitedummy
git pull origin master || git pull origin main
docker compose up -d --build

19
Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
# Build-Phase
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install --legacy-peer-deps
COPY . .
RUN npm run build
# Production-Phase
FROM nginx:alpine
# Nginx konfigurieren für non-root Port 8080
RUN sed -i 's/listen\( \)*80;/listen 8080;/g' /etc/nginx/conf.d/default.conf && \
touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid /var/cache/nginx /var/log/nginx /etc/nginx/conf.d
USER nginx
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 8080

19
docker-compose.yml Normal file
View File

@@ -0,0 +1,19 @@
version: '3.8'
services:
websitedummy:
build: .
image: websitedummy:latest
container_name: websitedummy
restart: always
read_only: true
tmpfs:
- /var/cache/nginx
- /var/run
ports:
- "127.0.0.1:8080:8080"
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M