28 lines
485 B
Plaintext
Raw Normal View History

FROM node:20
# Security: Drop all capabilities
USER root
2024-05-25 01:16:25 -07:00
RUN apt-get update && apt-get install -y libcap2-bin
RUN setcap cap_net_bind_service=+ep /usr/local/bin/node
WORKDIR /code
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
2024-05-25 01:16:25 -07:00
# Security: Create non-root user and assign ownership
2024-05-24 01:28:50 -07:00
RUN useradd -m sboxuser
RUN mkdir projects && chown -R sboxuser:sboxuser projects
USER sboxuser
2024-05-25 01:16:25 -07:00
# user namespace mapping
2024-05-24 01:28:50 -07:00
EXPOSE 8000
2024-05-25 01:16:25 -07:00
EXPOSE 5173
2024-05-25 01:16:25 -07:00
CMD [ "node", "dist/index.js" ]