-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 895 Bytes
/
Dockerfile
File metadata and controls
47 lines (34 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Base image with Node.js
FROM node:14 as base
# Set working directory
WORKDIR /.
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install --only=production
# Copy application code
COPY . .
# Expose the port used by the Express.js application
EXPOSE 3000
# Run the Node.js application
CMD ["node", "index.js"]
# Development image
FROM base as dev
ENV NODE_ENV=development
RUN npm install
CMD ["npm", "run", "dev"]
# Redis image
FROM redis:latest as redis
# RabbitMQ image
FROM rabbitmq:latest as rabbitmq
# PostgreSQL image
FROM postgres:latest as postgres
# Define environment variables for PostgreSQL
ENV POSTGRES_USER=your_postgres_user
ENV POSTGRES_PASSWORD=your_postgres_password
ENV POSTGRES_DB=your_postgres_db
# Build and run the containers
FROM dev as final
--link redis:redis
--link rabbitmq:rabbitmq
--link postgres:postgres