36 lines
1.2 KiB
Docker
36 lines
1.2 KiB
Docker
FROM node:18-alpine
|
|
# Install dependencies only when needed
|
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
|
RUN apk add --no-cache libc6-compat
|
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
|
|
# Enable `pnpm add --global` on Alpine Linux by setting
|
|
# home location environment variable to a location already in $PATH
|
|
# https://github.com/pnpm/pnpm/issues/784#issuecomment-1518582235
|
|
ENV PNPM_HOME=/usr/local/bin
|
|
|
|
# update and install latest dependencies, add dumb-init package
|
|
# add a non root user
|
|
RUN apk update && apk upgrade && apk add dumb-init ffmpeg make gcc g++ python3
|
|
|
|
WORKDIR /app
|
|
# Copy and install the dependencies for the project
|
|
COPY ./packages/capture/package.json ./packages/capture/pnpm-lock.yaml ./
|
|
|
|
# Copy all other project files to working directory
|
|
COPY ./packages/capture .
|
|
# Run the next build process and generate the artifacts
|
|
RUN pnpm i;
|
|
|
|
|
|
# expose 3000 on container
|
|
EXPOSE 3000
|
|
|
|
# set app host ,port and node env
|
|
ENV HOSTNAME=0.0.0.0 PORT=3000 NODE_ENV=production
|
|
# start the app with dumb init to spawn the Node.js runtime process
|
|
# with signal support
|
|
CMD [ "dumb-init", "node", "index.js" ]
|
|
|
|
|