17 Commits

Author SHA1 Message Date
92782bfff3 fix: fix incorrect environment variable name for frontend service 2025-12-04 20:28:50 +01:00
d052e464b2 fix: update environment variables in docker-compose for better configurability 2025-12-04 20:28:19 +01:00
962ae2d0d3 fix: remove unused runtime config 2025-12-04 20:27:55 +01:00
72bca8876e refactor: remove unused Caddyfile configuration 2025-12-04 20:11:52 +01:00
380cf51b77 Merge branch 'feature/docker-frankenphp' into feature/docker 2025-12-04 20:08:36 +01:00
a6164cdcf0 Merge branch 'develop' into feature/docker 2025-12-04 20:05:28 +01:00
cbfd4f1b68 refactor: remove unused NUXT_HOST and NUXT_PORT environment variables 2025-12-04 12:17:13 +01:00
be284c061e refactor: add sample domain and environment variables 2025-12-04 12:16:09 +01:00
e62fe4c443 feat: make backend image default to port 80 2025-12-04 12:10:48 +01:00
187b56b464 feat: build custom image for backend 2025-12-02 16:19:51 +01:00
c99017623b feat: add docker-compose stack with FrankenPHP 2025-12-02 15:32:23 +01:00
b1c26b762a feat: setup Dockerfile for frontend 2025-12-02 15:31:49 +01:00
77c4164dcb refactor: update docker-compose.yml to define service names and improve structure 2025-10-31 17:46:31 +01:00
550f07df79 fix: update php_fastcgi service reference in Caddyfile 2025-10-31 17:46:17 +01:00
4714cc7892 fix: correct CMD syntax in Dockerfile for frontend server 2025-10-31 17:45:47 +01:00
042cdcdb3a fix: update Sanctum base URL and origin for local development 2025-10-31 17:45:27 +01:00
79a8c4f229 feat: add basic Docker configuration for backend and frontend services 2025-10-28 12:28:11 +01:00
9 changed files with 174 additions and 2 deletions

9
backend/.dockerignore Normal file
View File

@@ -0,0 +1,9 @@
.git
.env
storage/logs/*
storage/framework/cache/*
storage/framework/sessions/*
storage/framework/views/*
bootstrap/cache/*
.phpunit.result.cache
vendor/*

18
backend/Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM dunglas/frankenphp:1.10-php8.4-bookworm
RUN install-php-extensions \
pdo_mysql \
gd \
intl \
zip \
opcache
COPY . /app
WORKDIR /app
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer install --no-dev --optimize-autoloader
ENV SERVER_NAME=:80

View File

@@ -0,0 +1,14 @@
#!/bin/bash
function exit_container_SIGTERM(){
echo "Caught SIGTERM"
exit 0
}
trap exit_container_SIGTERM SIGTERM
echo "Setting /app/public ownership..."
chgrp -R 33 /app
chown -hR 33:33 /app
echo "Starting PHP-FPM..."
php-fpm -F & wait

3
docker/.env.example Normal file
View File

@@ -0,0 +1,3 @@
BACKEND_URL=backend.example.com
FRONTEND_URL=example.com
SESSION_DOMAIN=.example.com

1
docker/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
mariadb_data/

84
docker/docker-compose.yml Normal file
View File

@@ -0,0 +1,84 @@
services:
isop-frontend:
container_name: isop-frontend
build:
context: ../frontend
dockerfile: Dockerfile
restart: unless-stopped
environment:
NUXT_PUBLIC_SANCTUM_BASE_URL: ${BACKEND_URL:-https://backend.example.com}
NUXT_PUBLIC_SANCTUM_ORIGIN: ${FRONTEND_URL:-https://example.com}
ports:
- 80:80
depends_on:
- isop-backend
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost"]
start_period: 10s
interval: 1m
timeout: 5s
retries: 5
isop-backend:
container_name: isop-backend
build:
context: ../backend
dockerfile: Dockerfile
restart: unless-stopped
environment:
APP_NAME: ISOP
APP_ENV: production
APP_KEY: SOME-KEY
APP_DEBUG: false
APP_URL: ${FRONTEND_URL:-https://example.com}
FRONTEND_URL: ${FRONTEND_URL:-https://example.com}
SANCTUM_STATEFUL_DOMAINS: ${BACKEND_URL:-https://backend.example.com},${FRONTEND_URL:-https://example.com}
SESSION_DOMAIN: ${SESSION_DOMAIN:-.example.com} # Note the first dot
APP_LOCALE: sk
APP_FALLBACK_LOCALE: en_US
MAIL_MAILER: smtp
MAIL_HOST: smtp.example.com
MAIL_PORT: 2525
MAIL_USERNAME: username
MAIL_PASSWORD: password
MAIL_FROM_ADDRESS: "noreply@example.com"
MAIL_FROM_NAME: "ISOP"
DB_CONNECTION: mariadb
DB_HOST: isop-database
DB_PORT: 3306
DB_DATABASE: isop
DB_USERNAME: root
DB_PASSWORD: admin
ports:
- 8111:80
depends_on:
isop-database:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost/api"]
start_period: 10s
interval: 1m
timeout: 5s
retries: 5
isop-database:
container_name: isop-database
image: mariadb:11.8.2-noble
restart: unless-stopped
cap_add:
# Allow memory binding
- SYS_NICE
environment:
MARIADB_DATABASE: "isop"
MARIADB_ROOT_PASSWORD: "admin"
volumes:
- ./mariadb_data:/var/lib/mysql
healthcheck:
test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ]
start_period: 10s
interval: 1m
timeout: 5s
retries: 3

8
frontend/.dockerignore Normal file
View File

@@ -0,0 +1,8 @@
.nuxt/
.output/
.env*
node_modules/
cypress/
cypress.config.ts
package-lock.json
*.md

37
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,37 @@
# Build Stage 1
FROM node:22-alpine AS build
WORKDIR /app
RUN corepack enable
# Copy package.json and your lockfile
COPY package.json ./
# Install dependencies
RUN pnpm i
# Copy the entire project
COPY . ./
# Prepare Nuxt (generates .nuxt with type definitions and auto-imports)
RUN pnpm run postinstall
# Build the project
RUN pnpm run build
# Build Stage 2
FROM node:22-alpine
WORKDIR /app
# Only `.output` folder is needed from the build stage
COPY --from=build /app/.output/ ./
# Change the port and host
ENV PORT=80
ENV HOST=0.0.0.0
EXPOSE 80
CMD ["node", "/app/server/index.mjs"]

View File

@@ -22,8 +22,6 @@ export default defineNuxtConfig({
},
sanctum: {
baseUrl: 'http://localhost:8000',
origin: 'http://localhost:3000',
redirect: {
onLogin: '/dashboard',
onLogout: "/",