Skip to content

Commit 6e2bd28

Browse files
committed
🐳 Add docker
1 parent 147d36d commit 6e2bd28

File tree

8 files changed

+695
-1090
lines changed

8 files changed

+695
-1090
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM node:20-slim AS base
2+
ENV PNPM_HOME="/pnpm"
3+
ENV PATH="$PNPM_HOME:$PATH"
4+
RUN corepack enable
5+
COPY . /app
6+
WORKDIR /app
7+
8+
FROM base AS prod-deps
9+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
10+
11+
FROM base AS build
12+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
13+
14+
RUN pnpm run build
15+
16+
RUN pnpm run build:website
17+
18+
FROM nginx:alpine
19+
20+
COPY default.conf /etc/nginx/conf.d/default.conf
21+
22+
COPY --from=build /app/website/dist /usr/share/nginx/html
23+
EXPOSE 8081
24+
CMD ["nginx", "-g", "daemon off;"]

default.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
server {
2+
listen 8081;
3+
server_name localhost;
4+
5+
location / {
6+
root /usr/share/nginx/html;
7+
index index.html index.htm;
8+
try_files $uri $uri/ /index.html;
9+
}
10+
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
],
1717
"scripts": {
1818
"build": "tsup src/index.tsx --format esm,cjs --dts",
19+
"build:website": "pnpm --filter website build",
1920
"dev": "pnpm --filter website dev",
2021
"format": "prettier --write .",
2122
"test": "echo \"Error: no test specified\" && exit 1"
@@ -51,5 +52,6 @@
5152
"prettier": "^3.4.2",
5253
"tsup": "^8.3.5",
5354
"typescript": "~5.6.3"
54-
}
55+
},
56+
"packageManager": "[email protected]"
5557
}

0 commit comments

Comments
 (0)