build: optimize Dockerfile for production and improve .dockerignore
This commit is contained in:
1 parent
6c98c4aeaf
commit
f79843d5b6
2 files changed
+8
-2
No files matched your search
@@ -1,5 +1,7 @@
|
||||
node_modules
|
||||
**/node_modules
|
||||
.git
|
||||
.gitignore
|
||||
.env
|
||||
db
|
||||
docs
|
||||
|
||||
+6
-2
@@ -7,14 +7,18 @@ RUN apk add --no-cache ffmpeg chromaprint
|
||||
|
||||
# Install dependencies
|
||||
COPY server/package*.json ./server/
|
||||
RUN cd server && npm install --production
|
||||
RUN cd server && npm ci --omit=dev
|
||||
|
||||
# Copy app source
|
||||
COPY server/ ./server/
|
||||
COPY public/ ./public/
|
||||
COPY shared/ ./shared/
|
||||
|
||||
# Set ownership and switch to non-root user
|
||||
RUN chown -R node:node /app
|
||||
USER node
|
||||
|
||||
# Start server
|
||||
WORKDIR /app/server
|
||||
EXPOSE 3000
|
||||
CMD ["npm", "start"]
|
||||
CMD ["node", "index.js"]
|
||||
Reference in new issue
Block a user