Fix Dockerfile

This commit is contained in:
KernelDeimos
2024-04-15 18:58:28 -04:00
parent e4f2c4a28b
commit 9bb221a0d7
2 changed files with 15 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
.dockerignore
Dockerfile
node_modules
puter
/puter

View File

@@ -1,3 +1,12 @@
# /!\ NOTICE /!\
# Many of the developers DO NOT USE the Dockerfile or image.
# While we do test new changes to Docker configuration, it's
# possible that future changes to the repo might break it.
# When changing this file, please try to make it as resiliant
# to such changes as possible; developers shouldn't need to
# worry about Docker unless the build/run process changes.
# Build stage
FROM node:21-alpine AS build
@@ -11,13 +20,13 @@ WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Copy the source files
COPY . .
# Install node modules
RUN npm cache clean --force \
&& npm ci
# Copy the rest of the source files
COPY . .
# Run the build command if necessary
RUN npm run build
@@ -39,7 +48,7 @@ WORKDIR /opt/puter/app
# Copy built artifacts and necessary files from the build stage
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
COPY package*.json ./
COPY . .
# Set permissions
RUN chown -R node:node /opt/puter/app
@@ -50,4 +59,4 @@ EXPOSE 4100
HEALTHCHECK --interval=30s --timeout=3s \
CMD wget --no-verbose --tries=1 --spider http://puter.localhost:4100/test || exit 1
CMD ["npm", "start"]
CMD ["npm", "start"]