mirror of
https://github.com/vernu/textbee.git
synced 2026-05-19 05:46:23 -04:00
Merge pull request #34 from mms-gianni/feature/add-docker-components
Add Docker Compose setup
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
PORT=
|
||||
MONGO_URI=
|
||||
MONGO_URI=mongodb://textbee-db:27017/textbee
|
||||
JWT_SECRET=secret
|
||||
JWT_EXPIRATION=60d
|
||||
|
||||
@@ -17,4 +17,4 @@ MAIL_PORT=
|
||||
MAIL_USER=
|
||||
MAIL_PASS=
|
||||
MAIL_FROM=
|
||||
MAIL_REPLY_TO=textbee.dev@gmail.com
|
||||
MAIL_REPLY_TO=textbee.dev@gmail.com
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM node:18-alpine AS base
|
||||
FROM node:lts-alpine AS base
|
||||
RUN npm i -g pnpm
|
||||
WORKDIR /app
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
@@ -13,7 +13,7 @@ FROM base AS build
|
||||
ENV NODE_ENV=production
|
||||
RUN pnpm build
|
||||
|
||||
FROM node:18-alpine AS prod
|
||||
FROM node:lts-alpine AS prod
|
||||
ENV NODE_ENV=production
|
||||
WORKDIR /app
|
||||
RUN npm i -g pnpm
|
||||
|
||||
36
docker-compose.yaml
Normal file
36
docker-compose.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
services:
|
||||
textbee-web:
|
||||
image: textbee-web
|
||||
container_name: textbee-web
|
||||
build:
|
||||
context: ./web
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "3000:3000"
|
||||
env_file:
|
||||
- path: ./web/.env
|
||||
required: true
|
||||
command: pnpm start
|
||||
textbee-api:
|
||||
image: textbee-api
|
||||
container_name: textbee-api
|
||||
build:
|
||||
context: ./api
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "3005:3005"
|
||||
env_file:
|
||||
- path: ./api/.env
|
||||
required: true
|
||||
depends_on:
|
||||
- textbee-db
|
||||
textbee-db:
|
||||
image: mongo
|
||||
container_name: textbee-db
|
||||
volumes:
|
||||
- textbee-db-data:/data/db
|
||||
ports:
|
||||
- "27017:27017"
|
||||
|
||||
volumes:
|
||||
textbee-db-data:
|
||||
18
web/Dockerfile
Normal file
18
web/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
FROM node:lts-alpine AS base
|
||||
|
||||
# Stage 1: Install web dependencies
|
||||
FROM base AS web-deps
|
||||
WORKDIR /app
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN corepack enable pnpm && pnpm install --frozen-lockfile
|
||||
|
||||
# Stage 2: Build the web application
|
||||
FROM base AS web-builder
|
||||
ENV NODE_ENV=production
|
||||
EXPOSE 3000
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
COPY --from=web-deps /app/node_modules ./node_modules
|
||||
RUN corepack enable pnpm && pnpm run vercel-build
|
||||
|
||||
CMD ["pnpm", "start"]
|
||||
Reference in New Issue
Block a user