diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 24d37cf..69bda0f 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -110,28 +110,6 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max - - name: Extract metadata for Frontend - id: meta-frontend - uses: docker/metadata-action@v5 - with: - images: git.allucanget.biz/zwitschi/linearvoid/frontend - tags: | - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=raw,value=latest,enable={{is_default_branch}} - - - name: Build and push Frontend image - uses: docker/build-push-action@v5 - with: - context: ./frontend - push: true - tags: ${{ steps.meta-frontend.outputs.tags }} - labels: ${{ steps.meta-frontend.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - - name: Extract metadata for Nginx id: meta-nginx uses: docker/metadata-action@v5 @@ -147,7 +125,8 @@ jobs: - name: Build and push Nginx image uses: docker/build-push-action@v5 with: - context: ./infrastructure/nginx + context: . + dockerfile: infrastructure/nginx/Dockerfile push: true tags: ${{ steps.meta-nginx.outputs.tags }} labels: ${{ steps.meta-nginx.outputs.labels }} diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index efcec15..45fafee 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -75,24 +75,6 @@ jobs: tags: ${{ steps.meta-chat.outputs.tags }} labels: ${{ steps.meta-chat.outputs.labels }} - - name: Extract metadata for Frontend - id: meta-frontend - uses: docker/metadata-action@v5 - with: - images: git.allucanget.biz/zwitschi/linearvoid/frontend - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=raw,value=latest - - - name: Build and push Frontend image - uses: docker/build-push-action@v5 - with: - context: ./frontend - push: true - tags: ${{ steps.meta-frontend.outputs.tags }} - labels: ${{ steps.meta-frontend.outputs.labels }} - - name: Extract metadata for Nginx id: meta-nginx uses: docker/metadata-action@v5 @@ -106,7 +88,8 @@ jobs: - name: Build and push Nginx image uses: docker/build-push-action@v5 with: - context: ./infrastructure/nginx + context: . + dockerfile: infrastructure/nginx/Dockerfile push: true tags: ${{ steps.meta-nginx.outputs.tags }} labels: ${{ steps.meta-nginx.outputs.labels }} diff --git a/docker-compose.yml b/docker-compose.yml index 6ec29d7..7a47634 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,8 +53,8 @@ services: nginx: image: ${CI_REGISTRY_URL:-git.allucanget.biz}/${CI_REGISTRY_NAMESPACE:-zwitschi/linearvoid}/nginx:latest build: - context: ./infrastructure/nginx - dockerfile: Dockerfile + context: . + dockerfile: infrastructure/nginx/Dockerfile container_name: linearvoid-nginx restart: unless-stopped ports: diff --git a/infrastructure/nginx/Dockerfile b/infrastructure/nginx/Dockerfile index 5899292..4d2776f 100644 --- a/infrastructure/nginx/Dockerfile +++ b/infrastructure/nginx/Dockerfile @@ -1,9 +1,21 @@ +# Stage 1: Build frontend +FROM node:20-alpine AS builder +WORKDIR /build +COPY frontend/package*.json ./ +RUN npm ci +COPY frontend/ . +RUN npm run build + +# Stage 2: Nginx with bundled frontend FROM nginx:alpine -COPY nginx.conf /etc/nginx/nginx.conf +COPY infrastructure/nginx/nginx.conf /etc/nginx/nginx.conf -# Create directories for HLS and frontend -RUN mkdir -p /srv/frontend /srv/hls /srv/frontend/admin +# Copy prebuilt frontend from builder stage +COPY --from=builder /build/dist/ /srv/frontend/ + +# Create HLS directory +RUN mkdir -p /srv/hls EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file