This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
name: Build and Deploy Fitness App
|
||||
name: Deploy Fitness App
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
@@ -12,30 +12,14 @@ jobs:
|
||||
- /opt/fitness:/opt/fitness
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Debug - Zeige Verzeichnisinhalt
|
||||
- name: Build & Deploy
|
||||
run: |
|
||||
pwd
|
||||
ls -la
|
||||
ls -la apps/api/ || echo "api-Ordner nicht gefunden"
|
||||
ls -la apps/web/ || echo "web-Ordner nicht gefunden"
|
||||
|
||||
- name: Build Backend Image
|
||||
run: |
|
||||
cd /workspace/robre/fitness-app
|
||||
docker build -f apps/api/Dockerfile -t fitness-api:latest .
|
||||
|
||||
- name: Build Frontend Image
|
||||
run: |
|
||||
cd /workspace/robre/fitness-app
|
||||
docker build -f apps/web/Dockerfile -t fitness-web:latest .
|
||||
|
||||
- name: Restart Application
|
||||
run: |
|
||||
docker stop fitness-web fitness-api 2>/dev/null || true
|
||||
docker rm fitness-web fitness-api 2>/dev/null || true
|
||||
cd /workspace/robre/fitness-app
|
||||
docker build -f Dockerfile.api -t fitness-api:latest .
|
||||
docker build -f Dockerfile.web -t fitness-web:latest .
|
||||
docker stop fitness-api fitness-web 2>/dev/null || true
|
||||
docker rm fitness-api fitness-web 2>/dev/null || true
|
||||
docker run -d --name fitness-api --network fitness_proxy-net -v fitness-data:/app/data fitness-api:latest
|
||||
docker run -d --name fitness-web --network fitness_proxy-net -e VIRTUAL_HOST=robre.de,www.robre.de -e LETSENCRYPT_HOST=robre.de,www.robre.de -e VIRTUAL_PORT=80 fitness-web:latest
|
||||
@@ -0,0 +1,14 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["apps/api/Api.csproj", "apps/api/"]
|
||||
RUN dotnet restore "apps/api/Api.csproj"
|
||||
COPY . .
|
||||
WORKDIR /src/apps/api
|
||||
RUN dotnet publish "Api.csproj" -c Release -o /app/publish
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/publish .
|
||||
EXPOSE 5000
|
||||
ENV ASPNETCORE_URLS=http://+:5000
|
||||
ENTRYPOINT ["dotnet", "Api.dll"]
|
||||
@@ -0,0 +1,14 @@
|
||||
FROM node:22-alpine AS build
|
||||
WORKDIR /app
|
||||
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
||||
COPY apps/web/package.json apps/web/
|
||||
RUN npm install -g pnpm && pnpm install --no-frozen-lockfile
|
||||
COPY apps/web/ apps/web/
|
||||
WORKDIR /app/apps/web
|
||||
RUN pnpm run build
|
||||
|
||||
FROM nginx:stable-alpine
|
||||
COPY --from=build /app/apps/web/dist /usr/share/nginx/html
|
||||
COPY apps/web/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user