Skip to content

Commit

Permalink
production ready
Browse files Browse the repository at this point in the history
  • Loading branch information
viperadnan-git committed Jan 30, 2024
1 parent 6a263af commit 86cc263
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Publish Docker image

on:
workflow_dispatch:
release:
types: [published]

Expand Down Expand Up @@ -41,17 +42,25 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v3
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}

push-to-github-packages:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest

env:
REGISTRY: ghcr.io

permissions:
contents: read
packages: write

steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -81,4 +90,4 @@ jobs:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM oven/bun:latest

WORKDIR /usr/src/app

ENV NODE_ENV=production

COPY package*.json ./

RUN bun install
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { webhookCallback } from "grammy";

const app = express();
const PORT = Number(process.env.PORT) || 3000;
const HOST = process.env.HOST || "localhost";
const HOST = process.env.HOST || process.env.NODE_ENV === "production" ? "0.0.0.0" : "localhost";

app.use(express.json());
app.use((req, res, next) => {
Expand Down

0 comments on commit 86cc263

Please sign in to comment.