From bbc04df5b39ac00c74b578259ad119f6e35fe4f2 Mon Sep 17 00:00:00 2001 From: kaveh Date: Sun, 22 Dec 2024 16:53:23 +0330 Subject: [PATCH] ADD: Docker and ENV --- Dockerfile | 20 ++++++++++++++++++++ config/.env | 3 +++ docker-compose.yml | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 Dockerfile create mode 100644 config/.env create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bf2e7e7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use the official Node.js image as a base +FROM node:18 + +# Set the working directory in the container +WORKDIR /app + +# Copy package.json and package-lock.json to the container +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# Expose the application port +EXPOSE 3000 + +# Start the application +CMD ["npm", "start"] diff --git a/config/.env b/config/.env new file mode 100644 index 0000000..55ad1db --- /dev/null +++ b/config/.env @@ -0,0 +1,3 @@ +MONGODB_URL=mongodb://admin:password@mongodb:27018/marbm?authSource=admin +NODE_ENV=development +PORT=3000 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ccb5417 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,38 @@ +services: + api-server: + build: ./ + ports: + - 3000:3000 + environment: + - MONGODB_URL=mongodb://admin:*135792468*@mongo:27017/marbm?authSource=admin + - NODE_ENV=development + - PORT=3000 + minio-client: + image: minio/mc + ports: + - 9000:9000 + volumes: + - bm_minio:/upload/ + mongo: + image: mongo:8.0 + ports: + - 27018:27017 + environment: + - MONGO_INITDB_ROOT_USERNAME=admin + - MONGO_INITDB_ROOT_PASSWORD=*135792468* + - MONGO_INITDB_DATABASE=test + volumes: + - bm_mongo:/data/db + + redis: + image: redis + command: redis-server --save 20 1 --loglevel warning --requirepass 135792468 + volumes: + - bm_redis:/data/ + ports: + - 6379:6379 + +volumes: + bm_mongo: + bm_redis: + bm_minio: \ No newline at end of file