Docker Container Setup
The API is designed to run inside a Docker container. The container includes the necessary dependencies and configurations for the API to function properly. The Docker container is built using the provided Dockerfile
.
Dockerfile
FROM node:20-alpine
LABEL maintainer="Martin HECQUEHxtninfosec | Peter BALIVETMasterBigD | MATHIS DI MASCIO"Ezeqielle"
# Create App directory for the project
RUN mkdir /app
# Change directory to /app
WORKDIR /app
# Copy all necessary files
COPY . .
RUN npm install --save
# If you are building your code for production
# RUN npm ci --omit=dev
# Set timezone
ENV TZ="Europe/Paris"
EXPOSE 5000
CMD [ "node", "app.js" ]
The Dockerfile
sets up the Docker container by:
- Using the
node:20-alpine
base image. - Creating an
/app
directory inside the container. - Changing the working directory to
/app
. - Copying all files from the current directory (the API source code) into the container's
/app
directory. - Installing the required dependencies using
npm install
. - Setting the timezone to
Europe/Paris
(change as needed). - Exposing port
5000
for the API to listen on. - Specifying the command to run the API using
CMD [ "node", "app.js" ]
.