Skip to content

Commit e4ab9fd

Browse files
committed
chore: website
1 parent 4da2655 commit e4ab9fd

File tree

5 files changed

+93
-1
lines changed

5 files changed

+93
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"workspaces": ["example/*", "plainstack"],
2+
"workspaces": ["example/*", "plainstack", "website"],
33
"scripts": {
44
"build": "bun --filter 'plainstack' build && bun --filter './example/*' build",
55
"test": "bun --filter '*' test"

website/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# syntax = docker/dockerfile:1
2+
3+
# use the official Bun image
4+
# see all versions at https://hub.docker.com/r/oven/bun/tags
5+
FROM oven/bun:1 AS base
6+
WORKDIR /usr/src/app
7+
8+
# install dependencies into temp directory
9+
# this will cache them and speed up future builds
10+
FROM base AS install
11+
RUN mkdir -p /temp/dev
12+
COPY package.json bun.lockb /temp/dev/
13+
RUN cd /temp/dev && bun install --frozen-lockfile
14+
15+
# install with --production (exclude devDependencies)
16+
RUN mkdir -p /temp/prod
17+
COPY package.json bun.lockb /temp/prod/
18+
RUN cd /temp/prod && bun install --frozen-lockfile --production
19+
20+
# copy node_modules from temp directory
21+
# then copy all (non-ignored) project files into the image
22+
FROM base AS prerelease
23+
COPY --from=install /temp/dev/node_modules node_modules
24+
COPY . .
25+
26+
# [optional] tests & build
27+
ENV NODE_ENV=production
28+
RUN bun run build
29+
30+
# copy production dependencies and source code into final image
31+
FROM base AS release
32+
COPY --from=install /temp/prod/node_modules node_modules
33+
COPY --from=prerelease /usr/src/app/app app
34+
COPY --from=prerelease /usr/src/app/static static
35+
COPY --from=prerelease /usr/src/app/tsconfig.json tsconfig.json
36+
37+
# run the app
38+
USER bun
39+
EXPOSE 3000/tcp
40+
ENTRYPOINT [ "bun", "run", "app/index.tsx" ]
41+

website/app.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Hono } from "hono";
2+
3+
const app = new Hono();
4+
5+
app.get("/", async (c) => {
6+
return c.redirect("https://github.com/justplainstuff/plainstack");
7+
});
8+
9+
export default app;

website/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"scripts": {
3+
"build": "tsc --noEmit"
4+
},
5+
"dependencies": {
6+
"plainstack": "latest",
7+
"hono": "latest"
8+
}
9+
}

website/tsconfig.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"include": ["**/*.ts", "**/*.tsx"],
4+
"exclude": ["node_modules", "dist"],
5+
"compilerOptions": {
6+
// enable latest features
7+
"lib": ["ESNext", "DOM"],
8+
"target": "ESNext",
9+
"module": "ESNext",
10+
"moduleDetection": "force",
11+
"jsx": "react-jsx",
12+
"jsxImportSource": "hono/jsx",
13+
"allowJs": false,
14+
15+
// bundler mode
16+
"moduleResolution": "bundler",
17+
"allowImportingTsExtensions": true,
18+
"verbatimModuleSyntax": true,
19+
"noEmit": true,
20+
21+
// best practices
22+
"strict": true,
23+
"skipLibCheck": true,
24+
"noFallthroughCasesInSwitch": true,
25+
"resolveJsonModule": true,
26+
27+
// some stricter flags (disabled by default)
28+
"noUnusedLocals": false,
29+
"noUnusedParameters": false,
30+
"noPropertyAccessFromIndexSignature": false,
31+
"noUncheckedIndexedAccess": true
32+
}
33+
}

0 commit comments

Comments
 (0)