Skip to content

Commit e3736fc

Browse files
committed
bump to node 22 and update dockerfile
1 parent 218d2b4 commit e3736fc

File tree

6 files changed

+80
-59
lines changed

6 files changed

+80
-59
lines changed

.env.example

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ GITHUB_SECRET=
44
GOOGLE_CLIENT_ID=
55
GOOGLE_CLIENT_SECRET=
66

7+
# Bucket for files such as statement and attachments
78
BUCKET_NAME=
89
BUCKET_KEY_ID=
910
BUCKET_KEY_SECRET=
11+
BUCKET_ENDPOINT=https://sgp1.digitaloceanspaces.com
12+
BUCKET_REGION=us-east-1
1013

1114
# Required for Pre-Render
1215
DATABASE_URL=
13-
DIRECT_URL=
14-
SHADOW_DATABASE_URL=
16+
# DIRECT_URL=
17+
# SHADOW_DATABASE_URL=
1518

1619
# Public URL
1720
NEXTAUTH_URL=http://localhost:3000
1821
NEXT_PUBLIC_REALTIME_URL=https://rtss.crackncode.org
1922
NEXT_PUBLIC_AWS_URL=https://prginth01.sgp1.cdn.digitaloceanspaces.com
20-
21-
BUCKET_ENDPOINT=https://sgp1.digitaloceanspaces.com
22-
BUCKET_REGION=us-east-1

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lts/iron
1+
lts/jod

Dockerfile

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
1-
# ? -------------------------
2-
# ? Base: Including OS Lib Dependencies and environment variable for build
3-
# ? -------------------------
1+
# check=skip=SecretsUsedInArgOrEnv
42

5-
FROM node:20-alpine AS base
63

7-
ENV DOCKER_BUILD 1
8-
ENV NEXT_PUBLIC_REALTIME_URL https://rtss.crackncode.org
9-
ENV NEXT_PUBLIC_AWS_URL https://prginth01.sgp1.cdn.digitaloceanspaces.com
4+
FROM node:22-alpine AS builder
105

11-
ENV GITHUB_ID mockvalue
12-
ENV GITHUB_SECRET mockvalue
13-
ENV GOOGLE_CLIENT_ID mockvalue
14-
ENV GOOGLE_CLIENT_SECRET mockvalue
6+
ENV DOCKER_BUILD=1
7+
ENV NEXT_PUBLIC_REALTIME_URL=https://rtss.crackncode.org
8+
ENV NEXT_PUBLIC_AWS_URL=https://prginth01.sgp1.cdn.digitaloceanspaces.com
159

16-
ENV BUCKET_NAME mockvalue
17-
ENV BUCKET_KEY_ID mockvalue
18-
ENV BUCKET_KEY_SECRET mockvalue
19-
ENV BUCKET_ENDPOINT mockvalue
20-
ENV BUCKET_REGION mockvalue
10+
ENV GITHUB_ID=mockvalue
11+
ENV GITHUB_SECRET=mockvalue
12+
ENV GOOGLE_CLIENT_ID=mockvalue
13+
ENV GOOGLE_CLIENT_SECRET=mockvalue
2114

22-
# ? -------------------------
23-
# ? Builder: Build production Next.js application to .next
24-
# ? -------------------------
25-
26-
FROM base AS builder
27-
28-
RUN apk add python3 make gcc g++
15+
ENV BUCKET_NAME=mockvalue
16+
ENV BUCKET_KEY_ID=mockvalue
17+
ENV BUCKET_KEY_SECRET=mockvalue
18+
ENV BUCKET_ENDPOINT=mockvalue
19+
ENV BUCKET_REGION=mockvalue
2920

3021
WORKDIR /app
3122

@@ -34,41 +25,36 @@ RUN corepack enable
3425
COPY package.json pnpm-lock.yaml* ./
3526
RUN pnpm install --frozen-lockfile
3627

37-
COPY src ./src
38-
COPY public ./public
39-
COPY next.config.mjs postcss.config.js tailwind.config.js tsconfig.json ./
40-
4128
COPY prisma ./prisma
4229
RUN pnpm prisma generate
4330

31+
COPY next.config.mjs postcss.config.js tailwind.config.js tsconfig.json ./
32+
33+
COPY src ./src
34+
COPY public ./public
35+
4436
ARG DATABASE_URL
45-
ENV DATABASE_URL ${DATABASE_URL}
37+
ENV DATABASE_URL=${DATABASE_URL}
4638

4739
RUN pnpm build
4840

49-
# ? -------------------------
50-
# ? Runner: Final Image for Production
51-
# ? -------------------------
52-
53-
FROM base AS runner
41+
FROM node:22-alpine AS runner
5442

5543
WORKDIR /app
5644

57-
LABEL name "programming.in.th"
45+
LABEL name="programming.in.th"
5846

5947
USER node
60-
ENV NODE_ENV production
48+
ENV NODE_ENV=production
6149

6250
COPY package.json ./
6351

64-
# Automatically leverage output traces to reduce image size
65-
# https://nextjs.org/docs/advanced-features/output-file-tracing
6652
COPY --chown=node:node --from=builder /app/.next/standalone ./
6753
COPY --chown=node:node --from=builder /app/.next/static ./.next/static
6854
COPY --chown=node:node --from=builder /app/public ./public
6955

70-
ENV PORT 3000
71-
ENV HOST 0.0.0.0
56+
ENV PORT=3000
57+
ENV HOST=0.0.0.0
7258

7359
EXPOSE 3000
7460
CMD ["node", "server.js"]

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "programming.in.th",
33
"private": true,
4-
"packageManager": "pnpm@9.5.0",
4+
"packageManager": "pnpm@10.17.1",
55
"engines": {
6-
"node": "^20.8"
6+
"node": "^22.12"
77
},
88
"lint-staged": {
99
"*.{json,md,yaml,css,scss}": [
@@ -19,8 +19,8 @@
1919
"scripts": {
2020
"preinstall": "npx only-allow pnpm",
2121
"dev": "next dev --turbo",
22-
"build": "prisma generate && next build",
23-
"start": "next start",
22+
"build": "prisma generate && rm -rf .next/standalone && next build && cp -r public .next/standalone/ && cp -r .next/static .next/standalone/.next/",
23+
"start": "cd .next/standalone && dotenv -e ../../.env -- node server.js",
2424
"lint": "next lint",
2525
"format": "prettier --write \"**/*.{js,mjs,json,css,scss,md,yml}\" && eslint src --fix",
2626
"prebuild": "prisma generate",
@@ -105,6 +105,7 @@
105105
"@vitejs/plugin-react": "4.3.1",
106106
"@vitest/coverage-v8": "2.0.3",
107107
"autoprefixer": "10.4.19",
108+
"dotenv-cli": "10.0.0",
108109
"eslint": "8.57.0",
109110
"eslint-config-next": "14.2.5",
110111
"eslint-config-prettier": "9.1.0",

pnpm-lock.yaml

Lines changed: 37 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/archive/[[...slug]]/page.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import CategoryList from '@/components/Archive/CategoryList'
99
import TaskList from '@/components/Archive/TaskList'
1010
import prisma from '@/lib/prisma'
1111
import { ISolved } from '@/types/tasks'
12-
import { generatePath, getCategory } from '@/utils/getCategoryTree'
12+
import { getCategory } from '@/utils/getCategoryTree'
1313

1414
export const metadata: Metadata = {
1515
title: 'Archive | programming.in.th'
@@ -70,9 +70,9 @@ async function generatePaths(slug: string[]) {
7070
return paths
7171
}
7272

73-
export async function generateStaticParams() {
74-
const paths = (await generatePath()).map(path => ({
75-
slug: path
76-
}))
77-
return paths
78-
}
73+
// export async function generateStaticParams() {
74+
// const paths = (await generatePath()).map(path => ({
75+
// slug: path
76+
// }))
77+
// return paths
78+
// }

0 commit comments

Comments
 (0)