From 570d45c6b530cd13dc49c9038fbee57a638e120e Mon Sep 17 00:00:00 2001 From: Atridad Lahiji Date: Fri, 7 Jun 2024 16:00:34 -0600 Subject: [PATCH] >:( --- Dockerfile | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dc96f5c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +ARG NODE_VERSION=21.5.0 +FROM node:${NODE_VERSION}-slim as base + +# Remix app lives here +WORKDIR /app + +# Set production environment +ENV NODE_ENV="production" + +# Install pnpm +ARG PNPM_VERSION=8.9.2 +RUN npm install -g pnpm@$PNPM_VERSION + + +# 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 build-essential pkg-config python-is-python3 + +# Install node modules +COPY --link package.json pnpm-lock.yaml ./ +RUN pnpm install --frozen-lockfile --prod=false + +# Copy application code +COPY --link . . + +# Build application +RUN pnpm run build + +# Remove development dependencies +RUN pnpm prune --prod + +# Final stage for app image +FROM base + +# Copy built application +COPY --from=build /app /app + +# Start the server by default, this can be overwritten at runtime +EXPOSE 3000 +CMD [ "pnpm", "run", "start" ] \ No newline at end of file