Skip to content

Commit

Permalink
fixed dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanderscycle committed Dec 2, 2023
1 parent 253e034 commit 3453442
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 87 deletions.
36 changes: 36 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Use a specific version tag instead of lts-alpine to ensure reproducibility
FROM node:18-alpine AS builder
WORKDIR /app

# Install pnpm
RUN apk add --no-cache curl && \
curl -fsSL https://get.pnpm.io/v6.16.js | node - add --global pnpm

# Export the PATH variable where pnpm is installed
ENV PATH /root/.pnpm/bin:$PATH

# Files required by pnpm install
COPY . .

# Install dependencies
RUN pnpm install --frozen-lockfile

# Build the app and prune dev dependencies
RUN pnpm run build
RUN ls -al
# Use a separate stage to minimize the final image size
FROM node:18-alpine
# It's a good practice to not run the application as root; use the node user instead
USER node

WORKDIR /app

# Copy the build output and node_modules from the previous stage
COPY --from=builder --chown=node:node /app/build /app
COPY --from=builder --chown=node:node /app/node_modules /app/node_modules
COPY --from=builder --chown=node:node /app/package.json /app/package.json

# Expose the port the app runs on
EXPOSE 3000

CMD ["node","./index.js"]
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
},
"devDependencies": {
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-auto": "^1.0.0-next.90",
"@sveltejs/kit": "^1.0.0-next.587",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
Expand All @@ -36,6 +35,7 @@
},
"type": "module",
"dependencies": {
"svelte-simple-modal": "^1.6.1"
"svelte-simple-modal": "^1.6.1",
"@sveltejs/adapter-node": "^1.3.1"
}
}
Loading

0 comments on commit 3453442

Please sign in to comment.