Created
November 10, 2023 19:52
docker file remix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM edgedb/edgedb as edgedb | |
# base node image | |
FROM node:18-bullseye-slim as base | |
# set for base and all that inherit from it | |
ENV NODE_ENV=production | |
# Install all node_modules, including dev dependencies | |
FROM base as deps | |
RUN mkdir /app | |
WORKDIR /app | |
ADD package.json package-lock.json ./ | |
RUN npm install --production=false | |
# Setup production node_modules | |
FROM base as production-deps | |
RUN mkdir /app | |
WORKDIR /app | |
COPY --from=deps /app/node_modules /app/node_modules | |
ADD package.json package-lock.json ./ | |
RUN npm prune --production | |
# Build the app | |
FROM base as build | |
RUN mkdir /app | |
WORKDIR /app | |
COPY --from=deps /app/node_modules /app/node_modules | |
ADD dbschema . | |
ADD . . | |
RUN npm run build | |
# Finally, build the production image with minimal footprint | |
FROM base | |
ENV NODE_ENV=production | |
RUN mkdir /app | |
WORKDIR /app | |
COPY --from=production-deps /app/node_modules /app/node_modules | |
COPY --from=build /app/build /app/build | |
COPY --from=build /app/public /app/public | |
COPY --from=edgedb /usr/bin/edgedb /usr/bin/edgedb | |
ADD . . | |
CMD ["node", "node_modules/.bin/remix-serve", "build"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment