-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from SkidGod4444/bugfix/docker
try to fix docker
- Loading branch information
Showing
23 changed files
with
610 additions
and
11,969 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,2 +1,6 @@ | ||
node_modules | ||
npm-debug.log | ||
pnpm-debug.log | ||
.git | ||
.gitignore | ||
*.md | ||
dist |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -9,6 +9,8 @@ on: | |
pull_request: | ||
branches: | ||
- main | ||
- 'feature/*' | ||
- 'bugfix/*' | ||
|
||
jobs: | ||
lint: | ||
|
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM namesmt/images-alpine:node-aws-dev_pnpm10.0.0-alpha.0 AS base | ||
|
||
RUN pnpm install -g turbo | ||
WORKDIR /usr/home/plura/api | ||
COPY package.json pnpm-lock.yaml ./ | ||
RUN pnpm install --no-frozen-lockfile | ||
|
||
FROM base AS builder | ||
|
||
WORKDIR /usr/home/plura/api | ||
COPY package.json pnpm-lock.yaml ./ | ||
RUN pnpm install --no-frozen-lockfile | ||
COPY . . | ||
ENV TURBO_REMOTE_CACHE=false | ||
RUN turbo prune api --docker | ||
|
||
FROM base AS installer | ||
|
||
WORKDIR /usr/home/plura/api | ||
|
||
COPY --from=builder /usr/home/plura/api/out/json/ . | ||
RUN pnpm install --no-frozen-lockfile | ||
COPY --from=builder /usr/home/plura/api/out/full/ . | ||
RUN pnpm run build | ||
RUN turbo build --filter=api... | ||
|
||
FROM base AS runner | ||
|
||
# RUN addgroup --system --gid 4444 honojs | ||
# RUN adduser --system --uid 4444 skidgod | ||
|
||
WORKDIR /usr/home/plura/api | ||
RUN pnpm install --no-frozen-lockfile | ||
# RUN chown -R skidgod:honojs /root/.local/share/pnpm | ||
|
||
# USER skidgod | ||
|
||
COPY --from=installer /usr/home/plura/api . | ||
|
||
# Start the application | ||
CMD ["pnpm", "start"] |
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,4 +1,4 @@ | ||
``` | ||
npm install | ||
npm run start | ||
npm run dev | ||
``` |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Hono } from 'hono' | ||
import { handle } from 'hono/vercel' | ||
|
||
export const runtime = 'edge' | ||
|
||
const app = new Hono().basePath('/api') | ||
|
||
app.get('/hello', (c) => { | ||
return c.json({ | ||
message: 'Hello from Hono!' | ||
}) | ||
}) | ||
|
||
export const GET = handle(app) |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { Metadata } from 'next' | ||
|
||
export const metadata: Metadata = { | ||
title: 'Hono | nextjs', | ||
description: 'Generated by hono' | ||
} | ||
|
||
export default function RootLayout({ | ||
children | ||
}: Readonly<{ | ||
children: React.ReactNode | ||
}>) { | ||
return ( | ||
<html lang="en"> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use client' | ||
import { useEffect, useState } from 'react' | ||
|
||
export default function Home() { | ||
const [message, setMessage] = useState() | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
const res = await fetch('/api/hello') | ||
const { message } = await res.json() | ||
setMessage(message) | ||
} | ||
fetchData() | ||
}, []) | ||
|
||
if (!message) return <p>Loading...</p> | ||
|
||
return <p>{message}</p> | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
} | ||
|
||
module.exports = nextConfig |
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,15 +1,21 @@ | ||
{ | ||
"name": "api", | ||
"scripts": { | ||
"start": "vercel dev", | ||
"deploy": "vercel --prod", | ||
"test": "vitest" | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint" | ||
}, | ||
"dependencies": { | ||
"hono": "^4.6.9" | ||
"hono": "^4.6.9", | ||
"next": "14.2.5", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0" | ||
}, | ||
"devDependencies": { | ||
"vercel": "^32.4.1", | ||
"vitest": "^2.1.4" | ||
"@types/node": "18.11.18", | ||
"@types/react": "18.0.26", | ||
"@types/react-dom": "18.0.10", | ||
"typescript": "^5" | ||
} | ||
} |
Binary file not shown.
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,10 +1,42 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"target": "es2022", | ||
"lib": [ | ||
"dom", | ||
"dom.iterable", | ||
"esnext" | ||
], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": [ | ||
"./*" | ||
] | ||
}, | ||
"plugins": [ | ||
{ | ||
"name": "next" | ||
} | ||
] | ||
}, | ||
"include": [ | ||
"next-env.d.ts", | ||
"**/*.ts", | ||
"**/*.tsx", | ||
".next/types/**/*.ts" | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
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,13 +1,43 @@ | ||
FROM node:20.12.0-alpine3.19 | ||
FROM namesmt/images-alpine:node-aws-dev_pnpm10.0.0-alpha.0 AS base | ||
|
||
RUN pnpm install -g turbo | ||
WORKDIR /usr/home/plura | ||
COPY package.json pnpm-lock.yaml ./ | ||
RUN pnpm install --no-frozen-lockfile | ||
|
||
COPY package.json package-lock.json turbo.json tsconfig.json ./ | ||
FROM base AS builder | ||
|
||
RUN pnpm install | ||
WORKDIR /usr/home/plura | ||
COPY package.json pnpm-lock.yaml ./ | ||
RUN pnpm install --no-frozen-lockfile | ||
COPY . . | ||
ENV TURBO_REMOTE_CACHE=false | ||
RUN turbo prune www --docker | ||
|
||
FROM base AS installer | ||
|
||
WORKDIR /usr/home/plura | ||
|
||
COPY --from=builder /usr/home/plura/out/json/ . | ||
RUN pnpm install --no-frozen-lockfile | ||
COPY --from=builder /usr/home/plura/out/full/ . | ||
RUN pnpm run build | ||
RUN turbo build --filter=www... | ||
|
||
FROM base AS runner | ||
|
||
# Don't run production as root | ||
# RUN addgroup --system --gid 4444 nextjs | ||
# RUN adduser --system --uid 4444 skidgod | ||
|
||
WORKDIR /usr/home/plura | ||
|
||
RUN pnpm install --no-frozen-lockfile | ||
# RUN chown -R skidgod:nextjs /root/.local/share/pnpm | ||
|
||
# USER skidgod | ||
|
||
EXPOSE 3001 | ||
COPY --from=installer /usr/home/plura . | ||
|
||
CMD ["pnpm", "start"] | ||
# Run the application | ||
CMD ["pnpm", "start"] |
Oops, something went wrong.