diff --git a/Dockerfile b/Dockerfile index 98298ea..b9e273f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,71 +1,20 @@ -# syntax=docker.io/docker/dockerfile:1 - -FROM node:lts-alpine AS base - -FROM base AS builder - +FROM node:lts-alpine AS deps WORKDIR /app - -RUN corepack enable \ - && corepack prepare yarn@4.9.1 --activate - -COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./ -RUN \ - if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ - elif [ -f package-lock.json ]; then npm ci; \ - elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \ - else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \ - fi - -COPY src ./src -COPY public ./public -COPY next.config.ts . -COPY tsconfig.json . - -ENV NEXT_TELEMETRY_DISABLED=1 - -RUN \ - if [ -f yarn.lock ]; then yarn build; \ - elif [ -f package-lock.json ]; then npm run build; \ - elif [ -f pnpm-lock.yaml ]; then pnpm build; \ - else npm run build; \ - fi - -FROM base AS runner - +RUN corepack enable && corepack prepare yarn@4.9.1 --activate +COPY package.json yarn.lock .yarnrc.yml ./ +RUN yarn install --immutable +FROM node:lts-alpine AS runner WORKDIR /app - -COPY --from=builder /app/package.json ./ -COPY --from=builder /app/yarn.lock* ./ -COPY --from=builder /app/package-lock.json* ./ -COPY --from=builder /app/pnpm-lock.yaml* ./ - -RUN corepack enable \ - && corepack prepare yarn@4.9.1 --activate - -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; \ - fi - -COPY --from=builder /app/src ./src -COPY --from=builder /app/public ./public -COPY --from=builder /app/next.config.ts . -COPY --from=builder /app/tsconfig.json . - -RUN addgroup --system --gid 1001 nodejs \ - && adduser --system --uid 1001 nextjs +RUN corepack enable && corepack prepare yarn@4.9.1 --activate \ + && addgroup -S nodejs -g 1001 \ + && adduser -S nextjs -u 1001 +COPY --from=deps /app/node_modules ./node_modules +COPY --from=deps /app/package.json ./package.json +COPY . . +RUN chown -R nextjs:nodejs /app USER nextjs - -ENV NEXT_TELEMETRY_DISABLED=1 - -ENTRYPOINT ["sh","-c","\ - if [ -f yarn.lock ]; then yarn build; \ - elif [ -f package-lock.json ]; then npm run build; \ - elif [ -f pnpm-lock.yaml ]; then pnpm build; \ - else npm run build; \ - fi && node server.js"] \ No newline at end of file +ENV NODE_ENV=production \ + NEXT_TELEMETRY_DISABLED=1 \ + PORT=3000 +EXPOSE 3000 +CMD ["sh", "-c", "yarn build && yarn start -p $PORT"] diff --git a/next.config.ts b/next.config.ts index 68a6c64..cb651cd 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,5 @@ import type { NextConfig } from "next"; -const nextConfig: NextConfig = { - output: "standalone", -}; +const nextConfig: NextConfig = {}; export default nextConfig; diff --git a/public/static/cellphone-bg.webp b/public/assets/cellphone-bg.webp similarity index 100% rename from public/static/cellphone-bg.webp rename to public/assets/cellphone-bg.webp diff --git a/public/static/inter-bold.ttf b/public/assets/inter-bold.ttf similarity index 100% rename from public/static/inter-bold.ttf rename to public/assets/inter-bold.ttf diff --git a/public/static/inter.ttf b/public/assets/inter.ttf similarity index 100% rename from public/static/inter.ttf rename to public/assets/inter.ttf diff --git a/public/static/pc-bg.webp b/public/assets/pc-bg.webp similarity index 100% rename from public/static/pc-bg.webp rename to public/assets/pc-bg.webp diff --git a/src/components/scene/Buttons.tsx b/src/components/scene/Buttons.tsx index f595d2a..df43ec9 100644 --- a/src/components/scene/Buttons.tsx +++ b/src/components/scene/Buttons.tsx @@ -185,7 +185,7 @@ export const Buttons = ({ @@ -312,7 +312,7 @@ export function Scene(props: JSX.IntrinsicElements["group"]) { : undefined } style={{ - backgroundImage: "url('/static/cellphone-bg.webp')", + backgroundImage: "url('/assets/cellphone-bg.webp')", backgroundColor: "black", }} distanceFactor={10} @@ -384,7 +384,7 @@ export function Scene(props: JSX.IntrinsicElements["group"]) { @@ -392,7 +392,7 @@ export function Scene(props: JSX.IntrinsicElements["group"]) {