feat: add Dockerfile and .dockerignore, refactor backend to use DATA_DIR for database and uploads
Now able to use docker image
This commit is contained in:
26
Dockerfile
Normal file
26
Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
||||
# Build frontend
|
||||
FROM node:24-alpine AS frontend
|
||||
WORKDIR /app/frontend
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm install
|
||||
COPY frontend ./
|
||||
RUN npm run build
|
||||
|
||||
# Build backend
|
||||
FROM node:24-alpine AS backend
|
||||
WORKDIR /app
|
||||
COPY backend/package*.json ./backend/
|
||||
COPY backend/ ./backend/
|
||||
RUN cd backend && npm install
|
||||
|
||||
RUN mkdir -p /data/uploads && chmod -R 777 /data
|
||||
|
||||
# Copy built frontend into backend
|
||||
COPY --from=frontend /app/frontend/dist ./frontend/dist
|
||||
|
||||
WORKDIR /app/backend
|
||||
EXPOSE 3000
|
||||
|
||||
ENV DATA_DIR=/data
|
||||
|
||||
CMD ["node", "index.js"]
|
||||
Reference in New Issue
Block a user