Something went wrong. Try again.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455# syntax = docker/dockerfile:1
# Adjust NODE_VERSION as desiredARG NODE_VERSION=18.18.2FROM node:${NODE_VERSION}-slim AS base
LABEL fly_launch_runtime="Node.js"
# Node.js app lives hereWORKDIR /app
# Set production environmentENV NODE_ENV="dev"
# Throw-away build stage to reduce size of final imageFROM base AS build
# Accept build argument for git SHA (for Sentry release tracking)ARG GIT_SHA
# Install packages needed to build node modulesRUN apt-get update -qq && \ apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3
# Install node modulesCOPY package-lock.json package.json ./RUN npm ci --include=dev
# Copy application codeCOPY . .
# Build applicationRUN npm run build
# Remove development dependenciesRUN npm prune --omit=dev
# Final stage for app imageFROM base
# Accept build argument for git SHA (needs to be declared in each stage)ARG GIT_SHA
# Set as environment variable for runtime access (Sentry release tracking)ENV GIT_SHA=${GIT_SHA}
# Copy built applicationCOPY --from=build /app /app
# Start the server by default, this can be overwritten at runtimeEXPOSE 3000CMD [ "node", "dist/index.js" ]