mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 04:33:11 +03:00
Интегрирован Docker compose
This commit is contained in:
parent
de44af6881
commit
bf2d6e67cc
9 changed files with 153 additions and 1 deletions
4
.env-sample
Normal file
4
.env-sample
Normal file
|
@ -0,0 +1,4 @@
|
|||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=my_password
|
||||
POSTGRES_DB=my_database
|
||||
DB_HOST=postgres
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,5 +2,7 @@
|
|||
CertSSL/
|
||||
charts/
|
||||
node_modules/
|
||||
postgres-data/
|
||||
|
||||
config.yaml
|
||||
.env
|
38
Dockerfile-collect-currency
Normal file
38
Dockerfile-collect-currency
Normal file
|
@ -0,0 +1,38 @@
|
|||
FROM node:20 as shared-config
|
||||
# Устанавливаем зависимости shared/config
|
||||
WORKDIR /
|
||||
COPY ./shared/config/package*.json .
|
||||
RUN npm install
|
||||
|
||||
FROM node:20 as shared-database
|
||||
# Устанавливаем зависимости shared/database
|
||||
WORKDIR /
|
||||
COPY ./shared/database/package*.json .
|
||||
RUN npm install
|
||||
|
||||
FROM node:20 as shared-logger
|
||||
# Устанавливаем зависимости shared/logger
|
||||
WORKDIR /
|
||||
COPY ./shared/logger/package*.json .
|
||||
RUN npm install
|
||||
|
||||
FROM node:20 as collect-currency
|
||||
|
||||
WORKDIR /
|
||||
|
||||
# Устанавливаем зависимости server
|
||||
COPY ./collect-currency/package*.json ./
|
||||
RUN npm install
|
||||
|
||||
# Копируем зависимости shared
|
||||
COPY --from=shared-config /node_modules /node_modules
|
||||
COPY --from=shared-database /node_modules /node_modules
|
||||
COPY --from=shared-logger /node_modules /node_modules
|
||||
|
||||
# Копируем все остальные файлы
|
||||
COPY ./collect-currency/ ./
|
||||
COPY ./shared/ ./shared/
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["node", "main.js"]
|
38
Dockerfile-server
Normal file
38
Dockerfile-server
Normal file
|
@ -0,0 +1,38 @@
|
|||
FROM node:20 as shared-config
|
||||
# Устанавливаем зависимости shared/config
|
||||
WORKDIR /
|
||||
COPY ./shared/config/package*.json .
|
||||
RUN npm install
|
||||
|
||||
FROM node:20 as shared-database
|
||||
# Устанавливаем зависимости shared/database
|
||||
WORKDIR /
|
||||
COPY ./shared/database/package*.json .
|
||||
RUN npm install
|
||||
|
||||
FROM node:20 as shared-logger
|
||||
# Устанавливаем зависимости shared/logger
|
||||
WORKDIR /
|
||||
COPY ./shared/logger/package*.json .
|
||||
RUN npm install
|
||||
|
||||
FROM node:20 as server
|
||||
|
||||
WORKDIR /
|
||||
|
||||
# Устанавливаем зависимости server
|
||||
COPY ./server/package*.json ./
|
||||
RUN npm install
|
||||
|
||||
# Копируем зависимости shared
|
||||
COPY --from=shared-config /node_modules /node_modules
|
||||
COPY --from=shared-database /node_modules /node_modules
|
||||
COPY --from=shared-logger /node_modules /node_modules
|
||||
|
||||
# Копируем все остальные файлы
|
||||
COPY ./server/ ./
|
||||
COPY ./shared/ ./shared/
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["node", "main.js"]
|
2
chart/.dockerignore
Normal file
2
chart/.dockerignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
mypy.ini
|
||||
pylintrc
|
12
chart/Dockerfile
Normal file
12
chart/Dockerfile
Normal file
|
@ -0,0 +1,12 @@
|
|||
FROM python:3.12
|
||||
|
||||
WORKDIR /
|
||||
|
||||
COPY ./requirements.txt ./
|
||||
|
||||
RUN pip3 install --no-cache-dir --upgrade -r ./requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 3030
|
||||
CMD ["python", "main.py"]
|
1
collect-currency/.dockerignore
Normal file
1
collect-currency/.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules/
|
54
docker-compose.yaml
Normal file
54
docker-compose.yaml
Normal file
|
@ -0,0 +1,54 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
server:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-server
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- '0.0.0.0:3000:3000'
|
||||
volumes:
|
||||
- './CertSSL:/CertSSL'
|
||||
- './config.yaml:/config.yaml'
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
chart:
|
||||
build:
|
||||
context: ./chart
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- '0.0.0.0:3030:3030'
|
||||
volumes:
|
||||
- './CertSSL:/CertSSL'
|
||||
- './config.yaml:/config.yaml'
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
collect-currency:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-collect-currency
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- './config.yaml:/config.yaml'
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
postgres:
|
||||
image: postgres:latest
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
volumes:
|
||||
- ./postgres-data:/var/lib/postgresql/data
|
||||
|
||||
volumes:
|
||||
server:
|
||||
driver: local
|
||||
chart:
|
||||
driver: local
|
||||
collect-currency:
|
||||
driver: local
|
||||
postgres:
|
||||
driver: local
|
1
server/.dockerignore
Normal file
1
server/.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules/
|
Loading…
Add table
Reference in a new issue