mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2025-03-14 10:33:19 +00:00
Refactor dockerfiles for clarity
This commit is contained in:
10
Docker/.gitignore
vendored
10
Docker/.gitignore
vendored
@ -1,7 +1,11 @@
|
||||
*.sh
|
||||
!quickstart.sh
|
||||
!build_images.sh
|
||||
mongo/data/*
|
||||
redis/data/*
|
||||
dev/mongo/data/*
|
||||
dev/redis/data/*
|
||||
dist/mongo/data/*
|
||||
dist/redis/data/*
|
||||
prod/mongo/data/*
|
||||
prod/redis/data/*
|
||||
*.env
|
||||
certbot/*
|
||||
prod/certbot/*
|
@ -1,22 +0,0 @@
|
||||
FROM node:20-alpine as build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./Client/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./Client .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# RUN npm install -g serve
|
||||
|
||||
# CMD ["serve","-s", "dist", "-l", "5173"]
|
||||
|
||||
FROM nginx:1.27.1-alpine
|
||||
|
||||
# COPY ./Docker/nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
@ -2,19 +2,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Change directory to root Server directory for correct Docker Context
|
||||
cd ..
|
||||
cd ../..
|
||||
|
||||
#Client
|
||||
client="./Docker/client.Dockerfile"
|
||||
client="./Docker/dev/client.Dockerfile"
|
||||
|
||||
# MongoDB
|
||||
mongoDB="./Docker/mongoDB.Dockerfile"
|
||||
mongoDB="./Docker/dev/mongoDB.Dockerfile"
|
||||
|
||||
# Redis
|
||||
redis="./Docker/redis.Dockerfile"
|
||||
redis="./Docker/dev/redis.Dockerfile"
|
||||
|
||||
# Server
|
||||
server="./Docker/server.Dockerfile"
|
||||
server="./Docker/dev/server.Dockerfile"
|
||||
|
||||
docker build -f $client -t uptime_client .
|
||||
docker build -f $mongoDB -t uptime_database_mongo .
|
15
Docker/dev/client.Dockerfile
Normal file
15
Docker/dev/client.Dockerfile
Normal file
@ -0,0 +1,15 @@
|
||||
FROM node:20-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ../../Client/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ../../Client .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
RUN npm install -g serve
|
||||
|
||||
CMD ["serve","-s", "dist", "-l", "5173"]
|
30
Docker/dev/docker-compose.yaml
Normal file
30
Docker/dev/docker-compose.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
services:
|
||||
client:
|
||||
image: uptime_client:latest
|
||||
ports:
|
||||
- "5173:5173"
|
||||
|
||||
depends_on:
|
||||
- server
|
||||
server:
|
||||
image: uptime_server:latest
|
||||
ports:
|
||||
- "5000:5000"
|
||||
env_file:
|
||||
- server.env
|
||||
depends_on:
|
||||
- redis
|
||||
- mongodb
|
||||
redis:
|
||||
image: uptime_redis:latest
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
mongodb:
|
||||
image: uptime_database_mongo:latest
|
||||
command: ["mongod", "--quiet"]
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
3
Docker/dev/mongoDB.Dockerfile
Normal file
3
Docker/dev/mongoDB.Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM mongo
|
||||
EXPOSE 27017
|
||||
CMD ["mongod"]
|
13
Docker/dev/server.Dockerfile
Normal file
13
Docker/dev/server.Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ../../Server/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ../../Server/ ./
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["node", "index.js"]
|
8
Docker/dist/client.Dockerfile
vendored
8
Docker/dist/client.Dockerfile
vendored
@ -1,19 +1,19 @@
|
||||
FROM node:20-alpine as build
|
||||
FROM node:20-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./Client/package*.json ./
|
||||
COPY ../../Client/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./Client .
|
||||
COPY ../../Client .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
|
||||
FROM nginx:1.27.1-alpine
|
||||
|
||||
COPY ./Docker/nginx/conf.d/dist_default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY ./Docker/dist/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
4
Docker/dist/server.Dockerfile
vendored
4
Docker/dist/server.Dockerfile
vendored
@ -2,11 +2,11 @@ FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./Server/package*.json ./
|
||||
COPY ../../Server/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./Server/ ./
|
||||
COPY ../../Server/ ./
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
FROM mongo
|
||||
COPY ./Docker/mongo/init/create_users.js /docker-entrypoint-initdb.d/
|
||||
EXPOSE 27017
|
||||
CMD ["mongod"]
|
24
Docker/prod/build_images.sh
Executable file
24
Docker/prod/build_images.sh
Executable file
@ -0,0 +1,24 @@
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Change directory to root directory for correct Docker Context
|
||||
cd ../..
|
||||
|
||||
#Client
|
||||
client="./Docker/prod/client.Dockerfile"
|
||||
|
||||
# MongoDB
|
||||
mongoDB="./Docker/prod/mongoDB.Dockerfile"
|
||||
|
||||
# Redis
|
||||
redis="./Docker/prod/redis.Dockerfile"
|
||||
|
||||
# Server
|
||||
server="./Docker/prod/server.Dockerfile"
|
||||
|
||||
docker build -f $client -t uptime_client .
|
||||
docker build -f $mongoDB -t uptime_database_mongo .
|
||||
docker build -f $redis -t uptime_redis .
|
||||
docker build -f $server -t uptime_server .
|
||||
|
||||
echo "All images built"
|
17
Docker/prod/client.Dockerfile
Normal file
17
Docker/prod/client.Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM node:20-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ../../Client/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ../../Client .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.27.1-alpine
|
||||
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
4
Docker/prod/mongoDB.Dockerfile
Normal file
4
Docker/prod/mongoDB.Dockerfile
Normal file
@ -0,0 +1,4 @@
|
||||
FROM mongo
|
||||
COPY ./Docker/prod/mongo/init/create_users.js /docker-entrypoint-initdb.d/
|
||||
EXPOSE 27017
|
||||
CMD ["mongod"]
|
2
Docker/prod/redis.Dockerfile
Normal file
2
Docker/prod/redis.Dockerfile
Normal file
@ -0,0 +1,2 @@
|
||||
FROM redis
|
||||
EXPOSE 6379
|
Reference in New Issue
Block a user