This repository has no description
1.2 kB
54 lines
1# syntax = docker/dockerfile:1
2
3# Adjust NODE_VERSION as desired
4ARG NODE_VERSION=18.18.2
5FROM node:${NODE_VERSION}-slim AS base
6
7LABEL fly_launch_runtime="Node.js"
8
9# Node.js app lives here
10WORKDIR /app
11
12# Set production environment
13ENV NODE_ENV="dev"
14
15
16# Throw-away build stage to reduce size of final image
17FROM base AS build
18
19# Accept build argument for git SHA (for Sentry release tracking)
20ARG GIT_SHA
21
22# Install packages needed to build node modules
23RUN apt-get update -qq && \
24 apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3
25
26# Install node modules
27COPY package-lock.json package.json ./
28RUN npm ci --include=dev
29
30# Copy application code
31COPY . .
32
33# Build application
34RUN npm run build
35
36# Remove development dependencies
37RUN npm prune --omit=dev
38
39
40# Final stage for app image
41FROM base
42
43# Accept build argument for git SHA (needs to be declared in each stage)
44ARG GIT_SHA
45
46# Set as environment variable for runtime access (Sentry release tracking)
47ENV GIT_SHA=${GIT_SHA}
48
49# Copy built application
50COPY --from=build /app /app
51
52# Start the server by default, this can be overwritten at runtime
53EXPOSE 3000
54CMD [ "node", "dist/index.js" ]