security: harden data auth and deployment
This commit is contained in:
+21
-11
@@ -1,4 +1,4 @@
|
||||
FROM node:24-slim AS frontend-builder
|
||||
FROM node:24-slim@sha256:2fe369e969550cde8e867afc3fe370b260140cab4a23d467074295b42163d553 AS frontend-builder
|
||||
|
||||
WORKDIR /frontend
|
||||
|
||||
@@ -13,11 +13,12 @@ COPY frontend/app ./app
|
||||
COPY frontend/public ./public
|
||||
COPY frontend/next-env.d.ts ./next-env.d.ts
|
||||
COPY frontend/next.config.js ./next.config.js
|
||||
COPY frontend/proxy.ts ./proxy.ts
|
||||
COPY frontend/tsconfig.json ./tsconfig.json
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM python:3.14-slim
|
||||
FROM python:3.14-slim@sha256:cad9a2c871761c413caa6fdd6441c783451e740a48aaeba60ae62a8b53525ef6
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -32,22 +33,31 @@ RUN apt-get update \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ARG MAGENT_UID=1000
|
||||
ARG MAGENT_GID=1000
|
||||
RUN groupadd --gid ${MAGENT_GID} magent \
|
||||
&& useradd --uid ${MAGENT_UID} --gid magent --create-home --shell /usr/sbin/nologin magent
|
||||
|
||||
COPY backend/requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY backend/app ./app
|
||||
COPY data/branding /app/data/branding
|
||||
COPY --chown=magent:magent backend/app ./app
|
||||
COPY --chown=magent:magent data/branding /app/data/branding
|
||||
|
||||
COPY --from=frontend-builder /frontend/.next /app/frontend/.next
|
||||
COPY --from=frontend-builder /frontend/public /app/frontend/public
|
||||
COPY --from=frontend-builder /frontend/node_modules /app/frontend/node_modules
|
||||
COPY --from=frontend-builder /frontend/package.json /app/frontend/package.json
|
||||
COPY --from=frontend-builder /frontend/next.config.js /app/frontend/next.config.js
|
||||
COPY --from=frontend-builder /frontend/next-env.d.ts /app/frontend/next-env.d.ts
|
||||
COPY --from=frontend-builder /frontend/tsconfig.json /app/frontend/tsconfig.json
|
||||
COPY --chown=magent:magent --from=frontend-builder /frontend/.next /app/frontend/.next
|
||||
COPY --chown=magent:magent --from=frontend-builder /frontend/public /app/frontend/public
|
||||
COPY --chown=magent:magent --from=frontend-builder /frontend/node_modules /app/frontend/node_modules
|
||||
COPY --chown=magent:magent --from=frontend-builder /frontend/package.json /app/frontend/package.json
|
||||
COPY --chown=magent:magent --from=frontend-builder /frontend/next.config.js /app/frontend/next.config.js
|
||||
COPY --chown=magent:magent --from=frontend-builder /frontend/proxy.ts /app/frontend/proxy.ts
|
||||
COPY --chown=magent:magent --from=frontend-builder /frontend/next-env.d.ts /app/frontend/next-env.d.ts
|
||||
COPY --chown=magent:magent --from=frontend-builder /frontend/tsconfig.json /app/frontend/tsconfig.json
|
||||
|
||||
COPY docker/supervisord.conf /etc/supervisor/conf.d/magent.conf
|
||||
|
||||
RUN chown -R magent:magent /app
|
||||
USER magent:magent
|
||||
|
||||
EXPOSE 3000 8000
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/magent.conf"]
|
||||
|
||||
Reference in New Issue
Block a user