Skip to main content

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="Hxtninfosec | MasterBigD | 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:

  1. Using the node:20-alpine base image.
  2. Creating an /app directory inside the container.
  3. Changing the working directory to /app.
  4. Copying all files from the current directory (the API source code) into the container's /app directory.
  5. Installing the required dependencies using npm install.
  6. Setting the timezone to Europe/Paris (change as needed).
  7. Exposing port 5000 for the API to listen on.
  8. Specifying the command to run the API using CMD [ "node", "app.js" ].