-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
44 lines (32 loc) · 1.01 KB
/
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
# Use Debian as build OS (https://github.com/nodejs/docker-node/issues/1973)
FROM node:slim AS BUILD
ENV NODE_ENV="production"
# Set the working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json (if available)
COPY package*.json ./
# Install dependencies
RUN npm i --verbose
# Use Alpine Linux as base image
FROM node:alpine
# Set default env variable values
ENV PORT=3000
ENV IMG_PATH="img/background"
ENV ORIGIN="http://localhost:3000"
ENV UNIFI_SITE="default"
ENV UNIFI_PORT="443"
ENV UNIFI_TLS=false
ENV REDIS_HOST="redis"
ENV REDIS_PORT=6379
ENV NODE_ENV="production"
WORKDIR /app
# Copy modules from the build stage
COPY --from=0 /app/node_modules ./node_modules
# Copy the rest of the application code
COPY . .
# Expose the port on which the Node.js application will run
EXPOSE 3000/tcp
# Configure healthcheck
HEALTHCHECK --start-period=10s --interval=1m --timeout=5s --retries=3 CMD node healthcheck.js || exit 1
# Command to run the Node.js application
CMD ["node", "server.js"]