]> Untitled Git - lemmy-ui.git/blobdiff - Dockerfile
Upgrading deps, running prettier. (#1987)
[lemmy-ui.git] / Dockerfile
index 0a23ea897b00c8fb118cac744d12f5d39ad1d971..00baae145182ff8b502fcbd14ae8c49c9e10f1a4 100644 (file)
@@ -1,4 +1,4 @@
-FROM node:alpine as builder\r
+FROM node:20.2-alpine as builder\r
 RUN apk update && apk add curl yarn python3 build-base gcc wget git --no-cache\r
 RUN curl -sf https://gobinaries.com/tj/node-prune | sh\r
 \r
@@ -7,7 +7,6 @@ WORKDIR /usr/src/app
 ENV npm_config_target_arch=x64\r
 ENV npm_config_target_platform=linux\r
 ENV npm_config_target_libc=musl\r
-ENV NODE_ENV=production\r
 \r
 # Cache deps\r
 COPY package.json yarn.lock ./\r
@@ -28,7 +27,7 @@ COPY .git .git
 RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts"\r
 \r
 RUN yarn --production --prefer-offline\r
-RUN yarn build:prod\r
+RUN NODE_OPTIONS="--max-old-space-size=8192" yarn build:prod\r
 \r
 # Prune the image\r
 RUN node-prune /usr/src/app/node_modules\r
@@ -43,6 +42,9 @@ FROM node:alpine as runner
 COPY --from=builder /usr/src/app/dist /app/dist\r
 COPY --from=builder /usr/src/app/node_modules /app/node_modules\r
 \r
+RUN chown -R node:node /app\r
+\r
+USER node\r
 EXPOSE 1234\r
 WORKDIR /app\r
 CMD node dist/js/server.js\r