-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (28 loc) · 841 Bytes
/
Dockerfile
File metadata and controls
37 lines (28 loc) · 841 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
# Use MongoDB base image
FROM mongo:latest
# Install Node.js and other dependencies
RUN apt-get update && apt-get install -y \
curl \
gnupg \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./
# Install dependencies
RUN npm install
# Bundle app source
COPY . .
# Create upload directories and MongoDB data directory
RUN mkdir -p public/uploads/items public/uploads/profiles /data/db
# Make scripts executable
COPY start.sh /start.sh
RUN chmod +x /start.sh
# Expose ports
EXPOSE 3000 27017
# Start MongoDB and Node.js app
CMD ["/start.sh"]