|
| 1 | +FROM node:22-alpine |
| 2 | + |
| 3 | + |
| 4 | +# * Same version as in Watchtower |
| 5 | +ARG EXPRESS_VERSION=4.18.2 |
| 6 | +ENV EXPRESS_VERSION $EXPRESS_VERSION |
| 7 | + |
| 8 | +# * path to the server files |
| 9 | +ARG SERVER_PATH /opt/server |
| 10 | +ENV SERVER_PATH=$SERVER_PATH |
| 11 | + |
| 12 | +# * Required to access to the globally installed modules |
| 13 | +ENV NODE_PATH=/usr/local/lib/node_modules |
| 14 | + |
| 15 | +# * Add path to the stored pnpm packages |
| 16 | +ENV PNPM_HOME=/root/.local/share/pnpm |
| 17 | +ENV PATH=$PATH:$PNPM_HOME |
| 18 | + |
| 19 | +# * Directory where the Nhost project is located |
| 20 | +ENV NHOST_PROJECT_PATH=/opt/project |
| 21 | + |
| 22 | +# * Default package manager |
| 23 | +ENV PACKAGE_MANAGER=pnpm |
| 24 | + |
| 25 | +# * Use a custom Typescript compiler rather than the one from the project |
| 26 | +ENV SWC_NODE_PROJECT $SERVER_PATH/tsconfig.json |
| 27 | + |
| 28 | +# install dependencies |
| 29 | +RUN apk update && apk upgrade && \ |
| 30 | + apk add --no-cache git openssh python3 make g++ |
| 31 | + |
| 32 | +# * Install packages that are required for this docker image to run |
| 33 | +RUN npm install -g pnpm nodemon express@$EXPRESS_VERSION morgan [email protected] tsx @antfu/ni |
| 34 | + |
| 35 | +# * The pnpm store should be mounted in the same volume as node_modules (requires hard links) |
| 36 | +# * See https://pnpm.io/6.x/npmrc#store-dir |
| 37 | +RUN pnpm config set store-dir $NHOST_PROJECT_PATH/node_modules/.pnpm-store |
| 38 | + |
| 39 | +# * Copy server files |
| 40 | +COPY nodemon.json start.sh server.ts tsconfig.json $SERVER_PATH/ |
| 41 | + |
| 42 | +# * Change working directory to the Nhost project directory |
| 43 | +WORKDIR $NHOST_PROJECT_PATH |
| 44 | +ENTRYPOINT $SERVER_PATH/start.sh |
0 commit comments