mirror of
https://github.com/BreizhHardware/Jellystat.git
synced 2026-01-18 16:27:20 +01:00
Added .dockerignore file to speed up local image builds
Changed Dockerfile as previos file was failing to build consistently removed some unused packages added compression to json payloads changed vite ports to 3000 to not break existing builds backend and frontend both use port 3000 now
This commit is contained in:
31
Dockerfile
31
Dockerfile
@@ -1,26 +1,21 @@
|
||||
# pull the Node.js Docker image
|
||||
FROM node:lts-alpine
|
||||
# Stage 1: Build the application
|
||||
FROM node:slim AS builder
|
||||
|
||||
# update the package index
|
||||
RUN apk update && apk add --no-cache tzdata
|
||||
WORKDIR /app
|
||||
|
||||
# set timezone data
|
||||
ENV TZ=Asia/Kuala_Lumpur
|
||||
COPY package*.json ./
|
||||
RUN npm cache clean --force
|
||||
RUN npm install
|
||||
|
||||
# create app directory
|
||||
WORKDIR /usr/src/app
|
||||
COPY ./ ./
|
||||
|
||||
# bundle app source
|
||||
COPY . .
|
||||
# Stage 2: Create the production image
|
||||
FROM node:slim
|
||||
|
||||
# install node_modules, build client React JS, delete node_modules server side, prune image for production, clear npm cache, delete unnecessary folder client side
|
||||
RUN npm install && \
|
||||
npm run build && \
|
||||
npm cache clean --force && \
|
||||
rm -rf src
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app .
|
||||
|
||||
# app run on port 3000
|
||||
EXPOSE 3000
|
||||
|
||||
# run the server
|
||||
CMD ["npm", "start"]
|
||||
CMD ["npm", "run", "start"]
|
||||
|
||||
Reference in New Issue
Block a user