-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
10 changed files
with
667 additions
and
333 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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
node_modules | ||
.dockerignore | ||
Dockerfile | ||
docker-compose.local.yml | ||
docker-compose.yml | ||
.git | ||
.next | ||
|
||
.env | ||
|
||
.env.local | ||
.env.example |
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
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
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
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 |
---|---|---|
@@ -1,51 +1,59 @@ | ||
# Use the official Node.js image | ||
FROM node:18-alpine AS builder | ||
# Stage 1: Base image | ||
FROM node:18-alpine AS base | ||
|
||
# Install libc6-compat for compatibility if needed | ||
RUN apk add --no-cache libc6-compat | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Install dependencies | ||
COPY package*.json ./ | ||
RUN npm install | ||
|
||
# Copy the rest of the application code | ||
# Stage 2: Install dependencies based on the preferred package manager | ||
FROM base AS deps | ||
|
||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ | ||
|
||
# Conditional installation of dependencies based on the lockfile present | ||
RUN \ | ||
if [ -f yarn.lock ]; then yarn install --frozen-lockfile; \ | ||
elif [ -f package-lock.json ]; then npm ci; \ | ||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm install; \ | ||
else echo "Lockfile not found." && exit 1; \ | ||
fi | ||
|
||
# Stage 3: Rebuild the source code only when needed | ||
FROM base AS builder | ||
|
||
WORKDIR /app | ||
|
||
# Copy dependencies from the previous stage | ||
COPY --from=deps /app/node_modules ./node_modules | ||
|
||
# Copy application source code | ||
COPY . . | ||
|
||
ARG HASURA_URL_ARG | ||
ARG HASURA_SECRET_ARG | ||
ARG NEXT_PUBLIC_HASURA_WS_ARG | ||
|
||
ENV HASURA_URL=$HASURA_URL_ARG | ||
ENV HASURA_SECRET=$HASURA_SECRET_ARG | ||
ENV NEXT_PUBLIC_HASURA_WS=$NEXT_PUBLIC_HASURA_WS_ARG | ||
|
||
# Build the application | ||
RUN npm run build | ||
|
||
# Stage 2: Run | ||
FROM node:18-alpine | ||
FROM base AS runner | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /app/package*.json ./ | ||
RUN npm install --production | ||
|
||
COPY --from=builder /app/.next ./.next | ||
COPY --from=builder /app/package.json . | ||
COPY --from=builder /app/package-lock.json . | ||
COPY --from=builder /app/next.config.js ./ | ||
COPY --from=builder /app/public ./public | ||
COPY --from=builder /app/.next/standalone ./ | ||
COPY --from=builder /app/.next/static ./.next/static | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["npm", "run", "start"] | ||
|
||
|
||
|
||
# Set environment variables for Hasura, Auth0, and Postgres | ||
# ENV NEXT_PUBLIC_HASURA_WS=${NEXT_PUBLIC_HASURA_WS} | ||
# ENV HASURA_SECRET=${HASURA_SECRET} | ||
# ENV HASURA_URL=${HASURA_URL} | ||
# ENV AUTH0_AUDIENCE=${AUTH0_AUDIENCE} | ||
# ENV AUTH0_BASE_URL=${AUTH0_BASE_URL} | ||
# ENV AUTH0_SECRET=${AUTH0_SECRET} | ||
# ENV AUTH0_ISSUER_BASE_URL=${AUTH0_ISSUER_BASE_URL} | ||
# ENV AUTH0_CLIENT_ID=${AUTH0_CLIENT_ID} | ||
# ENV AUTH0_CLIENT_SECRET=${AUTH0_CLIENT_SECRET} | ||
# ENV AUTH_SECRET=${AUTH_SECRET} | ||
# ENV POSTGRES_URL=${POSTGRES_URL} | ||
# ENV POSTGRES_URL_NON_POOLING=${POSTGRES_URL_NON_POOLING} | ||
# ENV POSTGRES_PRISMA_URL=${POSTGRES_PRISMA_URL} | ||
# ENV POSTGRES_USER=${POSTGRES_USER} | ||
# ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
# ENV POSTGRES_HOST=${POSTGRES_HOST} | ||
# ENV POSTGRES_DATABASE=${POSTGRES_DATABASE} | ||
CMD ["node", "server.js"] |
Oops, something went wrong.