-
-
Save Jarrodsz/22ddc163d1cd8c628e6dd7597b042117 to your computer and use it in GitHub Desktop.
Dockerfile
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
# Base node image. | |
FROM node:18-bullseye-slim as base | |
## --- START ENV | |
RUN apt-get update && apt-get install -y openssl curl | |
RUN npm install -g npm@latest | |
# Install all node_modules, including dev dependencies. | |
FROM base as deps | |
WORKDIR /app | |
ADD package.json package-lock.json .npmrc ./ | |
RUN npm install | |
# Setup production node_modules. | |
FROM base as production-deps | |
WORKDIR /app | |
RUN rm -rf /app/node_modules /app/node_modules | |
COPY --from=deps /app/node_modules /app/node_modules | |
ADD package.json package-lock.json .npmrc ./ | |
RUN npm prune --production | |
# Build the app | |
FROM base as build | |
WORKDIR /app | |
COPY --from=deps /app/node_modules /app/node_modules | |
# Run the typescript generators | |
ADD . ./ | |
RUN npm run build | |
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=build /app/dbschema/migrations /app/dbschema/migrations | |
COPY --from=build /app/start.sh /app/start.sh | |
ADD . ./ | |
CMD ["npm", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment