Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 46 lines 1.9 kB view raw
1# This is a fairly-standard multi-stage Dockerfile. We build 2# backend in a Node image, and then we copy the built files 3# (but not the devDependencies [like typescript, etc.] or the raw source 4# files) to final images that we'll actually run. This makes the final image a 5# bit lighter and more secure. When building the backend, we always 6# copy in package.json and package-lock.json first, as a distinct layer, so that 7# Docker's cache will let us skip installs when the dependencies haven't changed. 8# We build on debian because it has fewer dependency issues than Alpine for our 9# native modules, and we don't really care about the larger image size. 10FROM node:24.14.1-bullseye-slim AS server_base 11WORKDIR /app 12RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/* 13 14COPY ["server/package.json", "server/package-lock.json", "./"] 15RUN npm ci 16COPY ["server", "./"] 17 18FROM server_base AS build_backend 19RUN npm run build 20 21# make a shared layer that can be the base for worker and api images. 22FROM node:24.14.1-bullseye-slim AS backend_base 23WORKDIR /app 24RUN apt-get update && apt-get install dumb-init 25COPY --from=build_backend ["/app/package.json", "/app/package-lock.json", "./"] 26RUN npm ci --omit=dev 27COPY --from=build_backend /app/transpiled ./ 28 29# See https://github.com/Yelp/dumb-init 30ENTRYPOINT ["/usr/bin/dumb-init", "--"] 31 32# ARG is used to get the release id into the ENV from the command line, and then 33# the ENV command exposes the release id to the API app at runtime for logging. 34# We put this after npm installs so it doesn't invalidate cache of prior steps, 35# as it always changes. 36ARG BUILD_ID 37ENV BUILD_ID=$BUILD_ID 38 39# Expose 8080 because the backend will run on this port absent a 40# process.env.PORT to the contrary. 41FROM backend_base AS build_server 42EXPOSE 8080 43CMD ["node", "bin/www.js"] 44 45FROM backend_base AS build_worker_runner 46CMD ["node", "bin/run-worker-or-job.js"]