Skip to content

Commit 650294e

Browse files
committed
feat: add minimal honojs
1 parent b7c51fa commit 650294e

File tree

8 files changed

+503
-1
lines changed

8 files changed

+503
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build Docker images
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
jobs:
8+
build-and-push-dockerfile-image:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v3
14+
15+
- name: Log in to Docker Hub
16+
uses: docker/login-action@v2
17+
with:
18+
username: ${{ secrets.DOCKERHUB_USERNAME }}
19+
password: ${{ secrets.DOCKERHUB_TOKEN }}
20+
21+
- name: Build and push Docker image
22+
uses: docker/build-push-action@v4
23+
with:
24+
context: .
25+
file: ./Dockerfile
26+
push: true
27+
tags: |
28+
dokploy/example:latest
29+
platforms: linux/amd64
30+

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# dev
2+
.yarn/
3+
!.yarn/releases
4+
.vscode/*
5+
!.vscode/launch.json
6+
!.vscode/*.code-snippets
7+
.idea/workspace.xml
8+
.idea/usage.statistics.xml
9+
.idea/shelf
10+
11+
dist
12+
13+
# deps
14+
node_modules/
15+
16+
# env
17+
.env
18+
.env.production
19+
20+
# logs
21+
logs/
22+
*.log
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
pnpm-debug.log*
27+
lerna-debug.log*
28+
29+
# misc
30+
.DS_Store

Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM node:18-slim AS base
2+
ENV PNPM_HOME="/pnpm"
3+
ENV PATH="$PNPM_HOME:$PATH"
4+
RUN corepack enable
5+
6+
FROM base AS build
7+
COPY . /app
8+
WORKDIR /app
9+
10+
RUN apt-get update && rm -rf /var/lib/apt/lists/*
11+
12+
# Install dependencies
13+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
14+
15+
# Deploy only the dokploy app
16+
17+
ENV NODE_ENV=production
18+
RUN pnpm run build
19+
20+
RUN cp -R /app/dist /prod/dist
21+
22+
FROM base AS dokploy
23+
WORKDIR /app
24+
25+
# Set production
26+
ENV NODE_ENV=production
27+
28+
# Copy only the necessary files
29+
COPY --from=build /prod/dist ./dist
30+
COPY --from=build /prod/package.json ./package.json
31+
COPY --from=build /prod/node_modules ./node_modules
32+
33+
CMD HOSTNAME=0.0.0.0 && pnpm start

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
# production-example
1+
```
2+
npm install
3+
npm run dev
4+
```
5+
6+
```
7+
open http://localhost:3000
8+
```

package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "my-app",
3+
"type": "module",
4+
"scripts": {
5+
"dev": "tsx watch src/index.ts",
6+
"build": "tsc",
7+
"start": "node dist/index.js"
8+
},
9+
"dependencies": {
10+
"@hono/node-server": "^1.13.5",
11+
"hono": "^4.6.9"
12+
},
13+
"devDependencies": {
14+
"@types/node": "^20.11.17",
15+
"tsx": "^4.7.1",
16+
"typescript": "5.6.3"
17+
}
18+
}

0 commit comments

Comments
 (0)