-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.frontend.txt
51 lines (37 loc) · 1.68 KB
/
Dockerfile.frontend.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM node:20-alpine
# Install system dependencies
RUN apk add --no-cache \
poppler-utils \
wget \
&& rm -rf /var/cache/apk/*
WORKDIR /kenyare
# Install pnpm globally before switching to non-root user
RUN npm install -g pnpm
# Create non-root user
RUN addgroup -S kenyare_group && adduser -S kenyare_user -G kenyare_group
# Set proper ownership of the working directory and npm global directory
RUN mkdir -p /home/kenyare_user/.npm && \
chown -R kenyare_user:kenyare_group /home/kenyare_user/.npm && \
chown -R kenyare_user:kenyare_group /kenyare
# Create upload directories and set permissions with wider permissions
RUN mkdir -p /app/static/uploads/{proposals,audits,quotations} && \
chown -R kenyare_user:kenyare_group /app && \
chmod -R 777 /app/static/uploads
# Switch to non-root user
USER kenyare_user
# Copy package files with correct ownership
COPY --chown=kenyare_user:kenyare_group package.json pnpm-lock.yaml* ./
# Install dependencies as non-root user
RUN pnpm install
# Copy the rest of the application with correct ownership
COPY --chown=kenyare_user:kenyare_group . .
# Ensure temp directory exists and has correct permissions
RUN mkdir -p /kenyare/node_modules/.vite && \
mkdir -p /kenyare/node_modules/.pnpm && \
chown kenyare_user:kenyare_group /kenyare/node_modules/.vite && \
chown kenyare_user:kenyare_group /kenyare/node_modules/.pnpm
EXPOSE 5173
# Run in dev mode with host and port explicitly set with increased Node.js heap size to overcome esbuild issues on runtime
CMD ["sh", "-c", "node --max-old-space-size=4096 node_modules/vite/bin/vite.js dev -- --host 0.0.0.0 --port 5173"]
# Image metadata
LABEL name="kenyare-frontend" version="1.0"