Skip to content

Instantly share code, notes, and snippets.

@rubys
Created April 19, 2023 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubys/7704f257b2cfaf0d0b87daa1ba7af49b to your computer and use it in GitHub Desktop.
Save rubys/7704f257b2cfaf0d0b87daa1ba7af49b to your computer and use it in GitHub Desktop.
# syntax = docker/dockerfile:1
# Adjust NODE_VERSION as desired
ARG NODE_VERSION=19.7.0
FROM node:${NODE_VERSION}-slim as base
LABEL fly_launch_runtime="Remix/Prisma"
# Remix/Prisma app lives here
WORKDIR /app
# Set production environment
ENV NODE_ENV=production
# Throw-away build stage to reduce size of final image
FROM base as build
# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install -y python-is-python3 pkg-config build-essential openssl
# Install node modules
COPY --link package.json package-lock.json .
RUN npm install --production=false
# Generate Prisma Client
COPY --link prisma .
RUN npx prisma generate
# Copy application code
COPY --link . .
# Build application
RUN npm run build
# Remove development dependencies
RUN npm prune --production
# Final stage for app image
FROM base
# Copy built application
COPY --from=build /app /app
# Entrypoint prepares the database.
ENTRYPOINT ["/app/docker-entrypoint"]
# Start the server by default, this can be overwritten at runtime
CMD [ "npm", "run", "start" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment