-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7bb13f
commit 42c2919
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Stage 1: Dependencies | ||
FROM node:18-slim AS deps | ||
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* | ||
WORKDIR /app | ||
|
||
# Copy package files | ||
COPY package*.json ./ | ||
|
||
# Install dependencies | ||
RUN npm ci | ||
|
||
# Stage 2: Builder | ||
FROM node:18-slim AS builder | ||
WORKDIR /app | ||
|
||
# Copy dependencies from deps stage | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
# Build application | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
|
||
# Set public environment variables during build | ||
ARG NEXT_PUBLIC_APPWRITE_PROJECT_ID | ||
ARG NEXT_PUBLIC_APPWRITE_DATABASE_ID | ||
ARG NEXT_PUBLIC_APPWRITE_COLLECTION_ID | ||
ARG NEXT_PUBLIC_GITHUB_TOKEN | ||
ARG GROQ_API_KEY | ||
|
||
ENV NEXT_PUBLIC_APPWRITE_PROJECT_ID=$NEXT_PUBLIC_APPWRITE_PROJECT_ID | ||
ENV NEXT_PUBLIC_APPWRITE_DATABASE_ID=$NEXT_PUBLIC_APPWRITE_DATABASE_ID | ||
ENV NEXT_PUBLIC_APPWRITE_COLLECTION_ID=$NEXT_PUBLIC_APPWRITE_COLLECTION_ID | ||
ENV NEXT_PUBLIC_GITHUB_TOKEN=$NEXT_PUBLIC_GITHUB_TOKEN | ||
ENV GROQ_API_KEY=$GROQ_API_KEY | ||
|
||
RUN npm run build | ||
|
||
# Stage 3: Runner | ||
FROM node:18-slim AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV=production | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
|
||
# Create non-root user | ||
RUN addgroup --system --gid 1001 nodejs \ | ||
&& adduser --system --uid 1001 nextjs | ||
|
||
# Copy necessary files | ||
COPY --from=builder /app/next.config.mjs ./ | ||
COPY --from=builder /app/public ./public | ||
COPY --from=builder /app/package.json ./package.json | ||
|
||
# Copy build output | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
||
# Switch to non-root user | ||
USER nextjs | ||
|
||
# Expose port | ||
EXPOSE 3000 | ||
|
||
CMD ["node", "server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "Flow Forge Development Container", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": ".." | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/sh", | ||
"eslint.enable": true, | ||
"prettier.resolveGlobalModules": true | ||
}, | ||
"extensions": [ | ||
"esbenp.prettier-vscode", | ||
"dbaeumer.vscode-eslint", | ||
"ms-vscode.vscode-typescript-tslint" | ||
] | ||
} | ||
} | ||
} |