-
-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathDockerfile
47 lines (37 loc) · 982 Bytes
/
Dockerfile
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
FROM node:23
# Install necessary packages including tzdata for timezone setting
RUN apt-get update && apt-get install -y \
build-essential \
libnode108 \
nodejs \
python3 \
sqlite3 \
libsqlite3-dev \
make \
node-gyp \
g++ \
tzdata \
iputils-ping && \
rm -rf /var/lib/apt/lists/*
# Set the timezone environment variable
ENV TZ=Etc/UTC
# Set the working directory
WORKDIR /app
# Copy package files and install dependencies
COPY package*.json ./
RUN npm install && npm cache clean --force
# Copy the rest of the application code
COPY . .
# Ensure /app/uploads and /app/database have rw permissions
RUN mkdir -p /app/uploads /app/database && \
chmod -R 777 /app/uploads /app/database
# Build the application
RUN npm run build
# Argument for the port
ARG PORT=3000
# Set the environment variable for the port
ENV PORT=$PORT
# Expose the application port
EXPOSE $PORT
# Set the command to run the application
CMD ["node", "main"]