Skip to content

Commit

Permalink
feat: adding docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Pulkitxm committed Oct 17, 2024
1 parent 1d287ba commit a03475d
Show file tree
Hide file tree
Showing 11 changed files with 179 additions and 1,746 deletions.
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
up:
docker compose up -d

down:
docker compose down -v

delete:
docker compose down -v --rmi all

build:
docker compose build --no-cache

delPm2:
pm2 delete deployt-docker-orch

pm2Logs:
pm2 logs deployt-docker-orch

start:
make delPm2 && \
cd docker-builder && make build && \
cd ../docker-orch && pm2 start npm --name "deployt-docker-orch" -- start \
cd .. && docker compose up -d

stop:
make down && \
pm2 stop deployt-docker-orch
47 changes: 47 additions & 0 deletions core/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Node modules
node_modules

# Next.js build output
.next

# Logs
*.log
npm-debug.log*

# Environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Editor directories and files
.vscode
.idea
*.swp
*.swo

# OS generated files
.DS_Store
Thumbs.db

# Test coverage
coverage

# Temporary files
*.tmp
*.temp

# Prisma
prisma/*.db

# Debug files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Build files
out

# Misc
README.md
17 changes: 17 additions & 0 deletions core/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:18-alpine

WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . .

RUN npx prisma generate

RUN npm run build

EXPOSE 3000

CMD ["npm", "start"]
2 changes: 1 addition & 1 deletion docker-builder/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IMAGE_NAME=pulkitxm/vercel-builder-test
IMAGE_NAME=pulkitxm/deployit-builder
CONTAINER_NAME=test-vercel-builder
DOCKERFILE_PATH=Dockerfile
ENV_FILE=.env
Expand Down
2 changes: 1 addition & 1 deletion docker-builder/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "docker-builder",
"name": "deployit-docker-builder",
"version": "1.0.0",
"main": "index.js",
"scripts": {
Expand Down
41 changes: 19 additions & 22 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
services:

postgres:
container_name: deployit-postgres
image: postgres
core:
build:
context: ./core
dockerfile: Dockerfile
ports:
- "5432:5432"
- "3000:3000"
depends_on:
- redis
env_file:
- ./core/.env
volumes:
- postgres_data_dwl:/var/lib/postgresql/data
pgweb:
container_name: deployit-pgweb
restart: always
image: sosedoff/pgweb

proxy-server:
build:
context: ./proxy-server
dockerfile: Dockerfile
ports:
- "8002:8081"
links:
- postgres:postgres
env_file:
- ./core/.env
- "8000:8000"
depends_on:
- postgres
redis-stack:
container_name: deployit-redis-stack
- redis
env_file:
- ./proxy-server/.env

redis:
container_name: deployit-redis
image: redis/redis-stack:latest
ports:
- "6379:6379"
- "8001:8001"
restart: always

volumes:
postgres_data_dwl:
1 change: 1 addition & 0 deletions docker-orch/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "deployit-docker-orch",
"devDependencies": {
"@types/dockerode": "^3.3.31",
"@types/pg": "^8.11.10",
Expand Down
39 changes: 39 additions & 0 deletions proxy-server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Node modules
node_modules

# Logs
*.log
npm-debug.log*

# Environment variables
.env

# Editor directories and files
.vscode
.idea
*.swp
*.swo

# OS generated files
.DS_Store
Thumbs.db

# Test coverage
coverage

# Temporary files
*.tmp
*.temp

# Debug files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# TypeScript config and other config files
tsconfig.json
.eslintrc.json
.prettierrc

# Misc
README.md
13 changes: 13 additions & 0 deletions proxy-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:18-alpine

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 8000

CMD ["node", "src/index.js"]
11 changes: 2 additions & 9 deletions proxy-server/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "vercel-clone",
"name": "deployit-proxy-server",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"scripts": {
"start": "node src/index.js",
"dev": "nodemon src/index.js",
"build": "tsc -b",
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,md,mdx,css,yaml,yml}\"",
"check": "prettier --check \"**/*.{ts,tsx,js,jsx,md,mdx,css,yaml,yml}\""
},
Expand All @@ -15,20 +14,14 @@
"license": "ISC",
"description": "",
"dependencies": {
"@aws-sdk/client-s3": "^3.670.0",
"@aws-sdk/s3-request-presigner": "^3.670.0",
"@vercel/blob": "^0.24.1",
"axios": "^1.7.7",
"cloudinary": "^2.5.0",
"dotenv": "^16.4.5",
"express": "^4.21.1",
"express-http-proxy": "^2.1.1",
"http-proxy": "^1.18.1",
"http-proxy-middleware": "^3.0.2",
"ioredis": "^5.4.1",
"mime-types": "^2.1.35",
"pg": "^8.13.0",
"prettier": "^3.3.3",
"streamifier": "^0.1.1"
"prettier": "^3.3.3"
}
}
Loading

0 comments on commit a03475d

Please sign in to comment.