Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
create standalone infisical docker file
Maidul Islam0eceeb6aa907
diff --git a/Dockerfile.stand-alone-infisical b/Dockerfile.stand-alone-infisicalnew file mode 100644index 0000000000..49b74415e9--- /dev/null+++ b/Dockerfile.stand-alone-infisical@@ -0,0 +1,102 @@+ARG POSTHOG_HOST=https://app.posthog.com+ARG POSTHOG_API_KEY=posthog-api-key++FROM node:16-alpine AS frontend-dependencies++WORKDIR /app++COPY frontend/package.json frontend/package-lock.json frontend/next.config.js ./++# Install dependencies+RUN npm ci --only-production --ignore-scripts++# Rebuild the source code only when needed+FROM node:16-alpine AS frontend-builder+WORKDIR /app++# Copy dependencies+COPY --from=frontend-dependencies /app/node_modules ./node_modules+# Copy all files+COPY /frontend .++ENV NODE_ENV production+ENV NEXT_PUBLIC_ENV production+ARG POSTHOG_HOST+ENV NEXT_PUBLIC_POSTHOG_HOST $POSTHOG_HOST+ARG POSTHOG_API_KEY+ENV NEXT_PUBLIC_POSTHOG_API_KEY $POSTHOG_API_KEY++# Build+RUN npm run build++# Production image+FROM node:16-alpine AS frontend-runner+WORKDIR /app++RUN addgroup --system --gid 1001 nodejs+RUN adduser --system --uid 1001 nextjs++RUN mkdir -p /app/.next/cache/images && chown nextjs:nodejs /app/.next/cache/images+VOLUME /app/.next/cache/images++ARG POSTHOG_API_KEY+ENV NEXT_PUBLIC_POSTHOG_API_KEY=$POSTHOG_API_KEY \+ BAKED_NEXT_PUBLIC_POSTHOG_API_KEY=$POSTHOG_API_KEY++COPY --chown=nextjs:nodejs --chmod=555 frontend/scripts ./scripts+COPY --from=frontend-builder /app/public ./public+RUN chown nextjs:nodejs ./public/data+COPY --from=frontend-builder --chown=nextjs:nodejs /app/.next/standalone ./+COPY --from=frontend-builder --chown=nextjs:nodejs /app/.next/static ./.next/static++USER nextjs++ENV NEXT_TELEMETRY_DISABLED 1++##+## BACKEND+##+FROM node:16-alpine AS backend-build++WORKDIR /app++COPY backend/package*.json ./+RUN npm ci --only-production++COPY /backend .+RUN npm run build++# Production stage+FROM node:16-alpine AS backend-runner++WORKDIR /app++COPY backend/package*.json ./+RUN npm ci --only-production++COPY --from=backend-build /app .++# Production stage+FROM node:14-alpine AS production++WORKDIR /++# Install PM2+RUN npm install -g pm2+# Copy ecosystem.config.js+COPY ecosystem.config.js .++RUN apk add --no-cache nginx++COPY nginx/default-stand-alone-docker.conf /etc/nginx/nginx.conf++COPY --from=backend-runner /app /backend++COPY --from=frontend-runner /app/ /app/++EXPOSE 80+ENV HTTPS_ENABLED false++CMD ["pm2-runtime", "start", "ecosystem.config.js"]++diff --git a/ecosystem.config.js b/ecosystem.config.jsnew file mode 100644index 0000000000..5c8cc6832c--- /dev/null+++ b/ecosystem.config.js@@ -0,0 +1,32 @@+module.exports = {+ apps: [+ {+ name: 'frontend',+ script: "./scripts/start.sh",+ instances: 1,+ cwd: "./app",+ interpreter: 'sh',+ exec_mode: "fork",+ autorestart: true,+ watch: false,+ max_memory_restart: '500M',+ },+ {+ name: 'backend',+ script: 'npm',+ args: 'run start',+ cwd: "./backend",+ instances: 1,+ exec_mode: "fork",+ autorestart: true,+ watch: false,+ max_memory_restart: '500M',+ },+ {+ name: "nginx",+ script: "nginx",+ args: "-g 'daemon off;'",+ exec_interpreter: "none",+ },+ ],+};\ No newline at end of filediff --git a/nginx/default-stand-alone-docker.conf b/nginx/default-stand-alone-docker.confnew file mode 100644index 0000000000..b40e0fb135--- /dev/null+++ b/nginx/default-stand-alone-docker.conf@@ -0,0 +1,36 @@+events {}+http {+ server {+ listen 80;++ location /api {+ proxy_set_header X-Real-RIP $remote_addr;+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;++ proxy_set_header Host $http_host;+ proxy_set_header X-NginX-Proxy true;++ proxy_pass http://localhost:4000; # for backend+ proxy_redirect off;++ # proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";+ proxy_cookie_path / "/; HttpOnly; SameSite=strict";+ }++ location / {+ include /etc/nginx/mime.types;++ proxy_set_header X-Real-RIP $remote_addr;+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;++ proxy_set_header Host $http_host;+ proxy_set_header X-NginX-Proxy true;++ proxy_set_header Upgrade $http_upgrade;+ proxy_set_header Connection "upgrade";++ proxy_pass http://localhost:3000; # for frontend+ proxy_redirect off;+ }+ }+}\ No newline at end of file