Merge pull request #903 from bluewave-labs/feat/docker-refactor
Feat/docker refactor
This commit is contained in:
21 files changed
+131
-43
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
const BASE_URL =
|
const DEFAULT_API_URL = "http://localhost:5000/api/v1";
|
||||||
import.meta.env.VITE_APP_API_BASE_URL || "http://localhost:5000/api/v1";
|
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
|
||||||
import { logger } from "./Logger";
|
import { logger } from "./Logger";
|
||||||
class NetworkService {
|
class NetworkService {
|
||||||
constructor(store) {
|
constructor(store) {
|
||||||
@@ -10,8 +10,10 @@ class NetworkService {
|
|||||||
this.setBaseUrl(baseURL);
|
this.setBaseUrl(baseURL);
|
||||||
this.unsubscribe = store.subscribe(() => {
|
this.unsubscribe = store.subscribe(() => {
|
||||||
const state = store.getState();
|
const state = store.getState();
|
||||||
if (state.settings.apiBaseUrl) {
|
if (BASE_URL === "undefined" && state.settings.apiBaseUrl) {
|
||||||
baseURL = state.settings.apiBaseUrl;
|
baseURL = state.settings.apiBaseUrl;
|
||||||
|
} else {
|
||||||
|
baseURL = DEFAULT_URL;
|
||||||
}
|
}
|
||||||
this.setBaseUrl(baseURL);
|
this.setBaseUrl(baseURL);
|
||||||
});
|
});
|
||||||
|
|||||||
+7
-3
@@ -1,7 +1,11 @@
|
|||||||
*.sh
|
*.sh
|
||||||
!quickstart.sh
|
!quickstart.sh
|
||||||
!build_images.sh
|
!build_images.sh
|
||||||
mongo/data/*
|
dev/mongo/data/*
|
||||||
redis/data/*
|
dev/redis/data/*
|
||||||
|
dist/mongo/data/*
|
||||||
|
dist/redis/data/*
|
||||||
|
prod/mongo/data/*
|
||||||
|
prod/redis/data/*
|
||||||
*.env
|
*.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
|
#!/bin/bash
|
||||||
|
|
||||||
# Change directory to root Server directory for correct Docker Context
|
# Change directory to root Server directory for correct Docker Context
|
||||||
cd ..
|
cd ../..
|
||||||
|
|
||||||
#Client
|
#Client
|
||||||
client="./Docker/client.Dockerfile"
|
client="./Docker/dev/client.Dockerfile"
|
||||||
|
|
||||||
# MongoDB
|
# MongoDB
|
||||||
mongoDB="./Docker/mongoDB.Dockerfile"
|
mongoDB="./Docker/dev/mongoDB.Dockerfile"
|
||||||
|
|
||||||
# Redis
|
# Redis
|
||||||
redis="./Docker/redis.Dockerfile"
|
redis="./Docker/dev/redis.Dockerfile"
|
||||||
|
|
||||||
# Server
|
# Server
|
||||||
server="./Docker/server.Dockerfile"
|
server="./Docker/dev/server.Dockerfile"
|
||||||
|
|
||||||
docker build -f $client -t uptime_client .
|
docker build -f $client -t uptime_client .
|
||||||
docker build -f $mongoDB -t uptime_database_mongo .
|
docker build -f $mongoDB -t uptime_database_mongo .
|
||||||
@@ -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"]
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
FROM mongo
|
||||||
|
EXPOSE 27017
|
||||||
|
CMD ["mongod"]
|
||||||
File renamed without changes.
@@ -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"]
|
||||||
Vendored
+4
-4
@@ -1,19 +1,19 @@
|
|||||||
FROM node:20-alpine as build
|
FROM node:20-alpine AS build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY ./Client/package*.json ./
|
COPY ../../Client/package*.json ./
|
||||||
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
COPY ./Client .
|
COPY ../../Client .
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
FROM nginx:1.27.1-alpine
|
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
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
File renamed without changes.
Vendored
+2
-2
@@ -2,11 +2,11 @@ FROM node:20-alpine
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY ./Server/package*.json ./
|
COPY ../../Server/package*.json ./
|
||||||
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
COPY ./Server/ ./
|
COPY ../../Server/ ./
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
FROM mongo
|
|
||||||
COPY ./Docker/mongo/init/create_users.js /docker-entrypoint-initdb.d/
|
|
||||||
EXPOSE 27017
|
|
||||||
CMD ["mongod"]
|
|
||||||
Executable
+24
@@ -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"
|
||||||
@@ -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;"]
|
||||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,4 @@
|
|||||||
|
FROM mongo
|
||||||
|
COPY ./Docker/prod/mongo/init/create_users.js /docker-entrypoint-initdb.d/
|
||||||
|
EXPOSE 27017
|
||||||
|
CMD ["mongod"]
|
||||||
File renamed without changes.
@@ -0,0 +1,2 @@
|
|||||||
|
FROM redis
|
||||||
|
EXPOSE 6379
|
||||||
File renamed without changes.
Reference in new issue
Block a user