Skip to content

Commit

Permalink
Add dynamic port binding
Browse files Browse the repository at this point in the history
  • Loading branch information
Luan-vP committed Dec 25, 2023
1 parent 5712ae4 commit af89336
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ jobs:
context: .
push: true
tags: ghcr.io/${{ github.repository_owner }}/react-app-template:latest
build-args: PORT=5100

permissions: write-all
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ COPY --from=prerelease /usr/src/app/index.ts .
COPY --from=prerelease /usr/src/app/package.json .

USER bun
EXPOSE 5100/tcp

ARG PORT=5100
ENV PORT=${PORT}
EXPOSE ${PORT}/tcp
ENTRYPOINT [ "bun", "run", "index.ts"]
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ app.get("/healthcheck", (req: any, res: any) => {
});

const PORT = process.env.PORT || 5100; // TODO update from Docker env var
console.log(`Server started on port ${PORT}`);
app.listen(PORT);

0 comments on commit af89336

Please sign in to comment.