feat: update Docker Compose configuration and add deployment script
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
# Kopiera till .env och fyll i riktiga värden
|
||||||
|
# cp .env.example .env
|
||||||
|
|
||||||
|
# MariaDB
|
||||||
|
MARIADB_ROOT_PASSWORD=byt-ut-mig
|
||||||
|
MARIADB_DATABASE=recipe_app
|
||||||
|
MARIADB_USER=recipe_user
|
||||||
|
MARIADB_PASSWORD=byt-ut-mig
|
||||||
|
|
||||||
|
# Publik URL (används av frontend)
|
||||||
|
NEXT_PUBLIC_APP_URL=https://recept.gynther.se
|
||||||
|
NEXT_PUBLIC_API_URL=https://api.recept.gynther.se
|
||||||
+9
-3
@@ -4,10 +4,15 @@ services:
|
|||||||
context: ./frontend
|
context: ./frontend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
image: recipe-frontend:local
|
image: recipe-frontend:local
|
||||||
pull_policy: never
|
container_name: recipe-frontend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
NEXT_PUBLIC_API_URL: "http://recipe-api:8080"
|
NODE_ENV: "production"
|
||||||
|
HOSTNAME: "0.0.0.0"
|
||||||
|
PORT: "3000"
|
||||||
|
NEXT_PUBLIC_APP_URL: "${NEXT_PUBLIC_APP_URL}"
|
||||||
|
NEXT_PUBLIC_API_URL: "${NEXT_PUBLIC_API_URL}"
|
||||||
|
NEXT_PUBLIC_API_URL_INTERNAL: "http://recipe-api:8080"
|
||||||
volumes:
|
volumes:
|
||||||
- recipe_images:/app/public/images
|
- recipe_images:/app/public/images
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -28,9 +33,10 @@ services:
|
|||||||
context: ./backend
|
context: ./backend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
image: recipe-api:local
|
image: recipe-api:local
|
||||||
pull_policy: never
|
container_name: recipe-api
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
|
NODE_ENV: "production"
|
||||||
DATABASE_URL: "mysql://root:${MARIADB_ROOT_PASSWORD}@recipe-db:3306/${MARIADB_DATABASE}"
|
DATABASE_URL: "mysql://root:${MARIADB_ROOT_PASSWORD}@recipe-db:3306/${MARIADB_DATABASE}"
|
||||||
volumes:
|
volumes:
|
||||||
- recipe_images:/app/recipe-images
|
- recipe_images:/app/recipe-images
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# deploy.sh – Bygg och starta om recipe-app
|
||||||
|
# Kör från: /opt/containers/recipe-app/
|
||||||
|
# Kräver: .env-fil i samma mapp
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
|
if [ ! -f ".env" ]; then
|
||||||
|
echo "Fel: .env saknas. Kopiera .env.example och fyll i värdena:"
|
||||||
|
echo " cp .env.example .env && nano .env"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Bygger images..."
|
||||||
|
docker compose build
|
||||||
|
|
||||||
|
echo "Startar tjänster..."
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
echo "Status:"
|
||||||
|
docker compose ps
|
||||||
Reference in New Issue
Block a user