25 lines
703 B
Docker
25 lines
703 B
Docker
# Use the official Node.js 20 lightweight Alpine image as the base
|
|
FROM node:20-alpine
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /usr/src/app
|
|
|
|
# Copy dependency manifests
|
|
COPY package.json yarn.lock ./
|
|
|
|
# Install dependencies (using --frozen-lockfile to guarantee exact versions from yarn.lock)
|
|
RUN yarn install --frozen-lockfile
|
|
|
|
# Copy the rest of the application code
|
|
COPY . .
|
|
|
|
# Expose the port that the API server listens on (default is 3150)
|
|
EXPOSE 3150
|
|
|
|
# Set environment variables
|
|
ENV NODE_ENV=production
|
|
|
|
# By default, run the API server.
|
|
# To run the cron process, you can override the CMD at runtime: docker run <image> node src/cronIndex.js
|
|
CMD [ "node", "src/apiIndex.js" ]
|