diff --git a/.gitignore b/.gitignore index 092bcb5..84d8a73 100644 --- a/.gitignore +++ b/.gitignore @@ -132,4 +132,6 @@ dist .pnp.* -tests//*.js/*.js.map \ No newline at end of file +tests//*.js/*.js.map + +minio-data \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d7e2be4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM node:20-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +RUN npm run build + +FROM node:20-alpine + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install --production + +COPY --from=builder /app/dist ./dist + +EXPOSE 3000 +CMD [ "node", "dist/index.js" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f60e923 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,31 @@ +version: '3.8' + +services: + backend: + container_name: ledmatrix-backend + build: . + restart: always + env_file: + - .env + ports: + - "3000:3000" + depends_on: + - minio + networks: + - app-network + + minio: + image: minio/minio:latest + container_name: ledmatrix-storage + restart: always + env_file: + - .env + volumes: + - ./minio-data:/data + command: server /data --console-address ":9001" + networks: + - app-network + +networks: + app-network: + driver: bridge \ No newline at end of file diff --git a/ecosystem.config.js b/ecosystem.config.js deleted file mode 100644 index 4c372d3..0000000 --- a/ecosystem.config.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - apps: [ - { - name: 'matrix-backend', - script: 'dist/src/index.js', - instances: 1, - autorestart: true, - watch: false, - max_memory_restart: '1G', - env_production: { - NODE_ENV: 'production', - }, - - env_staging: { - NODE_ENV: 'staging', - PORT: 3000 - } - }, - ], -}; \ No newline at end of file