49 lines
1.1 KiB
Docker
49 lines
1.1 KiB
Docker
ARG VERSION=dev
|
|
ARG BUILD_DATE=unknown
|
|
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install frontend dependencies and build
|
|
COPY frontend/package*.json ./frontend/
|
|
RUN cd frontend && npm install
|
|
|
|
COPY frontend/ ./frontend/
|
|
RUN cd frontend && npm run build
|
|
|
|
# Backend
|
|
FROM node:20-alpine
|
|
|
|
ARG VERSION=dev
|
|
ARG BUILD_DATE=unknown
|
|
|
|
LABEL org.opencontainers.image.title="jama" \
|
|
org.opencontainers.image.description="Self-hosted team chat PWA" \
|
|
org.opencontainers.image.version="${VERSION}" \
|
|
org.opencontainers.image.created="${BUILD_DATE}" \
|
|
org.opencontainers.image.source="https://github.com/yourorg/jama"
|
|
|
|
ENV JAMA_VERSION=${VERSION}
|
|
|
|
RUN apk add --no-cache sqlite python3 make g++ openssl-dev
|
|
|
|
WORKDIR /app
|
|
|
|
COPY backend/package*.json ./
|
|
RUN npm install --omit=dev
|
|
|
|
# Remove build tools after compile to keep image lean
|
|
RUN apk del python3 make g++
|
|
|
|
COPY backend/ ./
|
|
COPY --from=builder /app/frontend/dist ./public
|
|
|
|
# Create data and uploads directories
|
|
RUN mkdir -p /app/data /app/uploads/avatars /app/uploads/logos /app/uploads/images
|
|
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "src/index.js"]
|