From 7e373a28a1a386b20f08f4a1787030810c0aee3c Mon Sep 17 00:00:00 2001 From: Monarch055 Date: Thu, 11 Jun 2026 08:37:49 +0700 Subject: [PATCH] chore: copy code files into images for Coolify & ignore local mounts --- .dockerignore | 10 ++++++++++ .gitignore | 5 +++++ docker-compose.yaml | 14 ++++++-------- docker/nextjs/Dockerfile | 14 +++++++++++--- docker/php/Dockerfile | 3 +++ 5 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e8f1453 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.git +.gitignore +docker-compose.override.yaml +docker-compose.override.yml +docker/ +sistem-km-next/node_modules/ +sistem-km-next/.next/ +sistem-km-next/out/ +*.sql +*.log diff --git a/.gitignore b/.gitignore index 28f3e19..c41600d 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,8 @@ sistem-km-next/sistem-km-old # general databases dumps *.sql + +# local docker compose override config +docker-compose.override.yaml +docker-compose.override.yml + diff --git a/docker-compose.yaml b/docker-compose.yaml index afa1f57..aaa136f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,10 +4,10 @@ services: # 1. PHP + Apache Web App (for Root Portal, SPBU, Parsil, and Chloropleth) # Coolify's Traefik reverse proxy routes traffic to this service via the domain set in Coolify UI. php-app: - build: ./docker/php + build: + context: . + dockerfile: ./docker/php/Dockerfile container_name: gis_php_app - volumes: - - .:/var/www/html environment: - DB_HOST=db - DB_DATABASE=spbu_db @@ -21,13 +21,11 @@ services: # 2. Next.js App Service # Coolify's Traefik reverse proxy routes traffic to this service via the domain set in Coolify UI. next-app: - build: ./docker/nextjs + build: + context: . + dockerfile: ./docker/nextjs/Dockerfile container_name: gis_next_app working_dir: /app - volumes: - - ./sistem-km-next:/app - - /app/node_modules # Anonymous volume to isolate node_modules from host machine - - /app/.next # Anonymous volume for nextjs build artifacts environment: - NEXT_PUBLIC_SUPABASE_URL=https://gzpvygrsfdtzykyqbnes.supabase.co - NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imd6cHZ5Z3JzZmR0enlreXFibmVzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzkxNTUxNTIsImV4cCI6MjA5NDczMTE1Mn0.bP4qLY6PVT9UplSxB276tZ5HWClIkiuZ_-Yx3IlL8Dw diff --git a/docker/nextjs/Dockerfile b/docker/nextjs/Dockerfile index 1aaac3e..14aa5bb 100644 --- a/docker/nextjs/Dockerfile +++ b/docker/nextjs/Dockerfile @@ -5,12 +5,20 @@ RUN apk add --no-cache libc6-compat WORKDIR /app +# Copy dependency files first +COPY sistem-km-next/package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application files +COPY sistem-km-next/ . + # Expose Next.js port EXPOSE 3000 ENV PORT 3000 ENV HOSTNAME "0.0.0.0" -# Automatically install dependencies (to handle architecture differences between Windows host and Linux container) -# and run Next.js in development mode -CMD ["sh", "-c", "npm install && npm run dev"] +# Start Next.js app in development mode +CMD ["npm", "run", "dev"] diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index e28c7fb..58d1835 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -12,5 +12,8 @@ RUN echo "LimitRequestFieldSize 65536" >> /etc/apache2/apache2.conf # Set working directory WORKDIR /var/www/html +# Copy source files +COPY . /var/www/html/ + # Expose port 80 EXPOSE 80