forked from ru-digital-ufpa/ru-server-new
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (29 loc) · 1 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
# Stage 1: Build
# This stage builds the application.
# It copies the necessary files and installs the dependencies.
FROM node:20-alpine AS build
# LABEL org.opencontainers.image.description=ru-server-new-docker
# Set the working directory
WORKDIR /app
# Copy the source code files
COPY . .
# Install the dependencies
RUN npm install --omit=dev
# Stage 2: Final image
# This stage creates the final image with the application.
# It sets the timezone and exposes the DB volume.
FROM node:20-alpine
# LABEL org.opencontainers.image.description = ru-server-new-docker
# Install the tzdata package
# Timezone setup (optimized)
ENV TZ=America/Sao_Paulo
RUN apk add --no-cache tzdata && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
echo $TZ > /etc/timezone
# Set the working directory
WORKDIR /opt/node_app
COPY --from=build /app/node_modules ./node_modules
# Copy the source code files
COPY --from=build /app ./
# Set the default command to run the application
CMD [ "node", "/opt/node_app/src/server.js" ]