Add Docker deployment configuration and CI/CD pipeline
This commit is contained in:
32
.dockerignore
Normal file
32
.dockerignore
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
README.md
|
||||||
|
.env*
|
||||||
|
.nyc_output
|
||||||
|
coverage
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
music/
|
||||||
|
*.mp3
|
||||||
|
*.wav
|
||||||
|
*.flac
|
||||||
|
*.m4a
|
||||||
|
*.ogg
|
||||||
|
*.aac
|
||||||
|
.output
|
||||||
|
.nuxt
|
||||||
|
.cache
|
||||||
|
dist
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
.tmp
|
||||||
|
.parcel-cache
|
||||||
|
docker-compose*.yml
|
||||||
|
Dockerfile*
|
||||||
46
.gitea/workflows/build.yml
Normal file
46
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
name: build-and-deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
#───────────────── build & push ─────────────────
|
||||||
|
build:
|
||||||
|
runs-on: docker
|
||||||
|
env:
|
||||||
|
REG: gitea.nucleoriofrio.com/nucleo000
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: docker/setup-buildx-action@v2
|
||||||
|
- uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: gitea.nucleoriofrio.com
|
||||||
|
username: nucleo000
|
||||||
|
password: 7bc7b2fcd283bd6a251bef3ede368b7f897c919d
|
||||||
|
|
||||||
|
- name: Build+push repodructor
|
||||||
|
run: |
|
||||||
|
docker build -t $REG/repodructor:${{ github.sha }} -t $REG/repodructor:latest .
|
||||||
|
docker push $REG/repodructor:${{ github.sha }}
|
||||||
|
docker push $REG/repodructor:latest
|
||||||
|
|
||||||
|
#───────────────── deploy ─────────────────
|
||||||
|
deploy:
|
||||||
|
needs: build
|
||||||
|
runs-on: docker
|
||||||
|
env:
|
||||||
|
REG: gitea.nucleoriofrio.com/nucleo000
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Login to registry
|
||||||
|
run: docker login gitea.nucleoriofrio.com -u nucleo000 -p 7bc7b2fcd283bd6a251bef3ede368b7f897c919d
|
||||||
|
|
||||||
|
- name: Pull fresh images used in compose
|
||||||
|
run: docker compose pull
|
||||||
|
|
||||||
|
- name: Clean up stack
|
||||||
|
run: docker compose --project-name repodructor down
|
||||||
|
|
||||||
|
- name: Update stack
|
||||||
|
run: docker compose --project-name repodructor up -d --remove-orphans --wait
|
||||||
16
.gitignore
vendored
16
.gitignore
vendored
@@ -87,4 +87,18 @@ music/
|
|||||||
|
|
||||||
# PWA files
|
# PWA files
|
||||||
sw.js
|
sw.js
|
||||||
workbox-*.js
|
workbox-*.js
|
||||||
|
|
||||||
|
# Docker and deployment
|
||||||
|
.env*
|
||||||
|
docker-compose.override.yml
|
||||||
|
.dockerignore
|
||||||
|
|
||||||
|
# SSL certificates
|
||||||
|
*.pem
|
||||||
|
*.crt
|
||||||
|
*.key
|
||||||
|
|
||||||
|
# Production secrets
|
||||||
|
secrets/
|
||||||
|
credentials/
|
||||||
33
Dockerfile
Normal file
33
Dockerfile
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Build stage
|
||||||
|
FROM node:18-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN npm ci --only=production
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Production stage
|
||||||
|
FROM node:18-alpine AS production
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy built application from builder stage
|
||||||
|
COPY --from=builder /app/.output ./
|
||||||
|
|
||||||
|
# Create music directory for volume mounting
|
||||||
|
RUN mkdir -p /app/public/music
|
||||||
|
|
||||||
|
# Expose port
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Start the application
|
||||||
|
CMD ["node", "server/index.mjs"]
|
||||||
29
docker-compose.yml
Normal file
29
docker-compose.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
repodructor:
|
||||||
|
image: gitea.nucleoriofrio.com/nucleo000/repodructor:latest
|
||||||
|
container_name: repodructor
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- type: volume
|
||||||
|
source: nas-music
|
||||||
|
target: /app/public/music
|
||||||
|
read_only: true
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
- NUXT_HOST=0.0.0.0
|
||||||
|
- NUXT_PORT=3000
|
||||||
|
networks:
|
||||||
|
- principal
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
nas-music:
|
||||||
|
driver_opts:
|
||||||
|
type: cifs
|
||||||
|
o: username=nucleo000,password=${NAS_PASSWORD},addr=memoria.interno.com
|
||||||
|
device: //memoria.interno.com/homes/nucleo000/musik
|
||||||
|
|
||||||
|
networks:
|
||||||
|
principal:
|
||||||
|
external: true
|
||||||
Reference in New Issue
Block a user