{"id":25519545,"url":"https://github.com/timeless-residents/handson-docker-render","last_synced_at":"2026-04-11T14:03:43.856Z","repository":{"id":277781473,"uuid":"933474128","full_name":"timeless-residents/handson-docker-render","owner":"timeless-residents","description":"Sample Express.js application with Docker deployment on Render.com, featuring graceful shutdown and containerization best practices","archived":false,"fork":false,"pushed_at":"2025-02-16T03:37:16.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T04:21:00.472Z","etag":null,"topics":["containerization","deployment","devops","docker","docker-compose","expressjs","graceful-shutdown","nodejs","render","web-service"],"latest_commit_sha":null,"homepage":"https://handson-docker-render.onrender.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timeless-residents.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-16T03:24:20.000Z","updated_at":"2025-02-16T03:37:20.000Z","dependencies_parsed_at":"2025-02-16T04:31:43.524Z","dependency_job_id":null,"html_url":"https://github.com/timeless-residents/handson-docker-render","commit_stats":null,"previous_names":["timeless-residents/handson-docker-render"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timeless-residents%2Fhandson-docker-render","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timeless-residents%2Fhandson-docker-render/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timeless-residents%2Fhandson-docker-render/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timeless-residents%2Fhandson-docker-render/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timeless-residents","download_url":"https://codeload.github.com/timeless-residents/handson-docker-render/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239699581,"owners_count":19682575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containerization","deployment","devops","docker","docker-compose","expressjs","graceful-shutdown","nodejs","render","web-service"],"created_at":"2025-02-19T17:19:54.618Z","updated_at":"2025-09-23T18:54:20.496Z","avatar_url":"https://github.com/timeless-residents.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express.js Docker Application\n\nこのプロジェクトは、Node.js/Express.jsアプリケーションをDockerコンテナで実行し、Render.comにデプロイするためのサンプルプロジェクトです。グレースフルシャットダウンやコンテナ化のベストプラクティスを実装しています。\n\n## 機能\n\n- Express.jsウェブサーバー\n- Dockerコンテナ化\n- 環境変数による設定\n- グレースフルシャットダウン対応\n- Render.comデプロイ設定\n\n## 技術スタック\n\n- Node.js 18\n- Express.js 4.21\n- Docker\n- Render.com (デプロイメント)\n\n## 前提条件\n\n- Docker Desktop\n- Node.js 18以上\n- npm 8以上\n- Git\n\n## ローカル開発環境のセットアップ\n\n1. リポジトリのクローン:\n```bash\ngit clone https://github.com/timeless-residents/handson-docker-render.git\ncd handson-docker-render\n```\n\n2. 依存関係のインストール:\n```bash\nnpm install\n```\n\n3. ローカルサーバーの起動:\n```bash\nnpm start\n```\n\n## Dockerでの実行\n\n1. Dockerイメージのビルド:\n```bash\ndocker build -t handson-docker-render .\n```\n\n2. コンテナの起動:\n```bash\ndocker run -p 3000:3000 handson-docker-render\n```\n\n## 環境変数\n\n| 変数名 | 説明 | デフォルト値 |\n|--------|------|--------------|\n| PORT | アプリケーションポート | 3000 |\n| NODE_ENV | 実行環境 | production |\n\n## プロジェクト構造\n\n```\nhandson-docker-render/\n├── Dockerfile          # Dockerイメージ設定\n├── index.js           # メインアプリケーション\n├── package.json       # プロジェクト設定\n├── package-lock.json  # 依存関係ロック\n└── README.md          # プロジェクト説明\n```\n\n## コードの特徴\n\n### グレースフルシャットダウン\n\nアプリケーションは`SIGTERM`と`SIGINT`シグナルを適切に処理し、進行中のリクエストを完了してからシャットダウンします：\n\n```javascript\nprocess.on(\"SIGTERM\", () =\u003e {\n  console.log(\"SIGTERM received. Performing graceful shutdown...\");\n  server.close(() =\u003e {\n    console.log(\"Server closed\");\n    process.exit(0);\n  });\n});\n```\n\n### Dockerコンテナ最適化\n\n- マルチステージビルド\n- 最小限のベースイメージ（alpine）\n- 適切なレイヤーキャッシュ\n- 環境変数の設定\n\n## Render.comへのデプロイ\n\n1. Render.comダッシュボードで新しいWebサービスを作成\n\n2. 以下の設定を行う:\n   - Build Command: 不要（Dockerfile内で設定）\n   - Start Command: 不要（Dockerfile内で設定）\n   - Instance Type: Free\n   - Region: Singapore（推奨）\n\n3. 環境変数の設定:\n   ```\n   NODE_ENV=production\n   PORT=3000\n   ```\n\n## トラブルシューティング\n\n### 一般的な問題と解決策\n\n1. ポートの競合:\n   ```bash\n   # 別のポートで実行\n   docker run -p 3001:3000 handson-docker-render\n   ```\n\n2. コンテナログの確認:\n   ```bash\n   docker logs \u003ccontainer-id\u003e\n   ```\n\n3. コンテナ内のシェルアクセス:\n   ```bash\n   docker exec -it \u003ccontainer-id\u003e /bin/sh\n   ```\n\n## 開発ガイドライン\n\n### コーディング規約\n\n- ESLintとPrettierの設定に従う\n- コミットメッセージは[Conventional Commits](https://www.conventionalcommits.org/)に準拠\n\n### テスト\n\n```bash\nnpm test\n```\n\n## パフォーマンス最適化\n\n1. コンテナサイズの最適化:\n   - .dockerignoreの適切な設定\n   - 不要なファイルの除外\n\n2. キャッシュの活用:\n   - 依存関係のレイヤー分離\n   - マルチステージビルドの活用\n\n## セキュリティ\n\n- 最新のnpm依存関係の使用\n- 環境変数による機密情報の管理\n- 最小限の実行権限\n\n## ライセンス\n\nこのプロジェクトはISCライセンスの下で公開されています。\n\n## 貢献\n\n1. このリポジトリをフォーク\n2. 新しいブランチを作成 (`git checkout -b feature/amazing-feature`)\n3. 変更をコミット (`git commit -m 'Add amazing feature'`)\n4. ブランチをプッシュ (`git push origin feature/amazing-feature`)\n5. プルリクエストを作成\n\n## お問い合わせ\n\n問題や提案がある場合は、GitHubのIssueを作成してください。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimeless-residents%2Fhandson-docker-render","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimeless-residents%2Fhandson-docker-render","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimeless-residents%2Fhandson-docker-render/lists"}