File tree Expand file tree Collapse file tree 3 files changed +130
-0
lines changed
Expand file tree Collapse file tree 3 files changed +130
-0
lines changed Original file line number Diff line number Diff line change 1+ # Git
2+ .git
3+ .gitignore
4+ .github
5+
6+ # Node.js
7+ node_modules
8+ npm-debug.log
9+ yarn-debug.log
10+ yarn-error.log
11+ pnpm-debug.log
12+
13+ # Build output
14+ dist
15+ node_modules
16+
17+ # Environment
18+ .env
19+ .env. *
20+ ! .env.example
21+
22+ # Editor directories and files
23+ .vscode
24+ .idea
25+ * .suo
26+ * .ntvs *
27+ * .njsproj
28+ * .sln
29+ * .sw ?
30+
31+ # OS generated files
32+ .DS_Store
33+ .DS_Store ?
34+ ._ *
35+ .Spotlight-V100
36+ .Trashes
37+ ehthumbs.db
38+ Thumbs.db
39+
40+ # Logs
41+ logs
42+ * .log
43+
44+ # Docker
45+ Dockerfile
46+ .dockerignore
47+
48+ # Project specific
49+ * .md
50+ ! README.md
51+ LICENSE
52+ CLAUDE.md
Original file line number Diff line number Diff line change 1+ name : Docker Build and Push
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+
7+ env :
8+ IMAGE_NAME : bytebase/dbhub
9+
10+ jobs :
11+ build-and-push :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v4
17+
18+ - name : Set up Docker Buildx
19+ uses : docker/setup-buildx-action@v3
20+
21+ - name : Log in to Docker Hub
22+ uses : docker/login-action@v3
23+ with :
24+ username : ${{ secrets.DOCKERHUB_USERNAME }}
25+ password : ${{ secrets.DOCKERHUB_TOKEN }}
26+
27+ - name : Build and push Docker image
28+ uses : docker/build-push-action@v5
29+ with :
30+ context : .
31+ push : true
32+ tags : ${{ env.IMAGE_NAME }}:latest
33+ cache-from : type=gha
34+ cache-to : type=gha,mode=max
Original file line number Diff line number Diff line change 1+ FROM node:22-alpine AS builder
2+
3+ WORKDIR /app
4+
5+ # Copy package.json and pnpm-lock.yaml
6+ COPY package.json pnpm-lock.yaml ./
7+
8+ # Install pnpm
9+ RUN corepack enable && corepack prepare pnpm@latest --activate
10+
11+ # Install dependencies
12+ RUN pnpm install
13+
14+ # Copy source code
15+ COPY . .
16+
17+ # Build the application
18+ RUN pnpm run build
19+
20+ # Production stage
21+ FROM node:22-alpine
22+
23+ WORKDIR /app
24+
25+ # Copy only production files
26+ COPY --from=builder /app/package.json /app/pnpm-lock.yaml ./
27+
28+ # Install pnpm
29+ RUN corepack enable && corepack prepare pnpm@latest --activate
30+
31+ # Install production dependencies only
32+ RUN pnpm install --prod
33+
34+ # Copy built application from builder stage
35+ COPY --from=builder /app/dist ./dist
36+
37+ # Expose ports
38+ EXPOSE 8080
39+
40+ # Set environment variables
41+ ENV NODE_ENV=production
42+
43+ # Run the server
44+ CMD ["pnpm" , "start" ]
You can’t perform that action at this time.
0 commit comments