mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 12:49:43 +02:00
feat: Development environment with docker compose (#709)
This commit is contained in:
parent
8ef27ca32a
commit
12ece8dfac
4 changed files with 159 additions and 35 deletions
18
config/development/Dockerfile.client
Normal file
18
config/development/Dockerfile.client
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
FROM node:18-alpine as server-dependencies
|
||||||
|
|
||||||
|
RUN apk -U upgrade \
|
||||||
|
&& apk add build-base python3 \
|
||||||
|
--no-cache
|
||||||
|
|
||||||
|
WORKDIR /app/client
|
||||||
|
COPY package.json package-lock.json /app/client/
|
||||||
|
RUN npm install npm@latest --global \
|
||||||
|
&& npm install pnpm --global \
|
||||||
|
&& pnpm import \
|
||||||
|
&& pnpm install
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR /app/
|
||||||
|
COPY ../../package.json ../../package-lock.json /app/
|
||||||
|
RUN pnpm import \
|
||||||
|
&& pnpm install
|
14
config/development/Dockerfile.server
Normal file
14
config/development/Dockerfile.server
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
FROM node:18-alpine as server-dependencies
|
||||||
|
|
||||||
|
RUN apk -U upgrade \
|
||||||
|
&& apk add build-base python3 \
|
||||||
|
--no-cache
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
|
||||||
|
RUN npm install npm@latest --global \
|
||||||
|
&& npm install pnpm --global \
|
||||||
|
&& pnpm import \
|
||||||
|
&& pnpm install
|
47
config/development/nginx.conf
Normal file
47
config/development/nginx.conf
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
user nginx;
|
||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://server:1337;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection 'upgrade';
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /socket.io {
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_pass http://server:1337/socket.io;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://client:3000;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection 'upgrade';
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,20 +1,18 @@
|
||||||
version: '3'
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
planka:
|
|
||||||
image: ghcr.io/plankanban/planka:master
|
|
||||||
restart: on-failure
|
|
||||||
volumes:
|
|
||||||
- user-avatars:/app/public/user-avatars
|
|
||||||
- project-background-images:/app/public/project-background-images
|
|
||||||
- attachments:/app/private/attachments
|
|
||||||
ports:
|
|
||||||
- 3000:1337
|
|
||||||
environment:
|
|
||||||
- BASE_URL=http://localhost:3000
|
|
||||||
- DATABASE_URL=postgresql://postgres@postgres/planka
|
|
||||||
- SECRET_KEY=notsecretkey
|
|
||||||
|
|
||||||
|
server:
|
||||||
|
build:
|
||||||
|
context: ./server
|
||||||
|
dockerfile: ../config/development/Dockerfile.server
|
||||||
|
volumes:
|
||||||
|
- ./server:/app
|
||||||
|
- /app/node_modules
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
|
- DATABASE_URL=postgresql://user:password@postgres:5432/planka_db
|
||||||
|
- SECRET_KEY=notsecretkey
|
||||||
# - TRUST_PROXY=0
|
# - TRUST_PROXY=0
|
||||||
# - TOKEN_EXPIRES_IN=365 # In days
|
# - TOKEN_EXPIRES_IN=365 # In days
|
||||||
|
|
||||||
|
@ -25,20 +23,6 @@ services:
|
||||||
|
|
||||||
# Configure knex to accept SSL certificates
|
# Configure knex to accept SSL certificates
|
||||||
# - KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false
|
# - KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false
|
||||||
|
|
||||||
# - DEFAULT_ADMIN_EMAIL=demo@demo.demo # Do not remove if you want to prevent this user from being edited/deleted
|
|
||||||
# - DEFAULT_ADMIN_PASSWORD=demo
|
|
||||||
# - DEFAULT_ADMIN_NAME=Demo Demo
|
|
||||||
# - DEFAULT_ADMIN_USERNAME=demo
|
|
||||||
|
|
||||||
# Email Notifications (https://nodemailer.com/smtp/)
|
|
||||||
# - SMTP_HOST=
|
|
||||||
# - SMTP_PORT=587
|
|
||||||
# - SMTP_SECURE=true
|
|
||||||
# - SMTP_USER=
|
|
||||||
# - SMTP_PASSWORD=
|
|
||||||
# - SMTP_FROM="Demo Demo" <demo@demo.demo>
|
|
||||||
|
|
||||||
# - OIDC_ISSUER=
|
# - OIDC_ISSUER=
|
||||||
# - OIDC_CLIENT_ID=
|
# - OIDC_CLIENT_ID=
|
||||||
# - OIDC_CLIENT_SECRET=
|
# - OIDC_CLIENT_SECRET=
|
||||||
|
@ -51,26 +35,87 @@ services:
|
||||||
# - OIDC_IGNORE_USERNAME=true
|
# - OIDC_IGNORE_USERNAME=true
|
||||||
# - OIDC_IGNORE_ROLES=true
|
# - OIDC_IGNORE_ROLES=true
|
||||||
# - OIDC_ENFORCED=true
|
# - OIDC_ENFORCED=true
|
||||||
|
|
||||||
|
# Email Notifications (https://nodemailer.com/smtp/)
|
||||||
|
# - SMTP_HOST=
|
||||||
|
# - SMTP_PORT=587
|
||||||
|
# - SMTP_SECURE=true
|
||||||
|
# - SMTP_USER=
|
||||||
|
# - SMTP_PASSWORD=
|
||||||
|
# - SMTP_FROM="Demo Demo" <demo@demo.demo>
|
||||||
|
|
||||||
|
# - SLACK_BOT_TOKEN=
|
||||||
|
# - SLACK_CHANNEL_ID=
|
||||||
|
|
||||||
|
working_dir: /app
|
||||||
|
command: ["sh", "-c", "npm run start"]
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
client:
|
||||||
|
build:
|
||||||
|
context: ./client
|
||||||
|
dockerfile: ../config/development/Dockerfile.client
|
||||||
|
volumes:
|
||||||
|
- ./client:/app/client
|
||||||
|
- /app/client/node_modules
|
||||||
|
- /app/node_modules
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
|
- CHOKIDAR_USEPOLLING=true
|
||||||
|
- BASE_URL=http://localhost:3000
|
||||||
|
- REACT_APP_SERVER_BASE_URL=http://localhost:3000
|
||||||
|
working_dir: /app/client
|
||||||
|
command: npm start
|
||||||
|
|
||||||
|
init-db:
|
||||||
|
build:
|
||||||
|
context: ./server
|
||||||
|
dockerfile: ../config/development/Dockerfile.server
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgresql://user:password@postgres:5432/planka_db
|
||||||
|
# - DEFAULT_ADMIN_EMAIL=demo@demo.demo # Do not remove if you want to prevent this user from being edited/deleted
|
||||||
|
# - DEFAULT_ADMIN_PASSWORD=demo
|
||||||
|
# - DEFAULT_ADMIN_NAME=Demo Demo
|
||||||
|
# - DEFAULT_ADMIN_USERNAME=demo
|
||||||
|
|
||||||
|
working_dir: /app
|
||||||
|
command: ["sh", "-c", "npm run db:init"]
|
||||||
|
volumes:
|
||||||
|
- ./server:/app
|
||||||
|
- /app/node_modules
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:14-alpine
|
image: postgres:latest
|
||||||
restart: on-failure
|
|
||||||
volumes:
|
volumes:
|
||||||
- db-data:/var/lib/postgresql/data
|
- db-data:/var/lib/postgresql/data
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_DB=planka
|
POSTGRES_DB: planka_db
|
||||||
- POSTGRES_HOST_AUTH_METHOD=trust
|
POSTGRES_USER: user
|
||||||
|
POSTGRES_PASSWORD: password
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U postgres -d planka"]
|
test: ["CMD-SHELL", "pg_isready -U postgres -d planka"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|
||||||
|
proxy:
|
||||||
|
image: nginx:alpine
|
||||||
|
ports:
|
||||||
|
- "3000:80"
|
||||||
|
volumes:
|
||||||
|
- ./config/development/nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
depends_on:
|
||||||
|
- server
|
||||||
|
- client
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
user-avatars:
|
|
||||||
project-background-images:
|
|
||||||
attachments:
|
|
||||||
db-data:
|
db-data:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue