Skip to content

Commit

Permalink
build: add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
tfkhdyt committed Sep 26, 2023
1 parent af3be64 commit cdeca6b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
.env
.env.production
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM oven/bun AS builder

WORKDIR /src

COPY . .

ENV NODE_ENV=production

RUN bun i && \
bun run generate && \
bun build --target bun --outfile dist/kbbi.js ./src/main.ts

FROM oven/bun

WORKDIR /app

COPY --from=builder /src/dist/kbbi.js /app/kbbi.js
COPY --from=builder /src/package.json /app/package.json
COPY --from=builder /src/bun.lockb /app/bun.lockb
COPY --from=builder /src/drizzle /app/drizzle

RUN bun i

ENTRYPOINT [ "bun run /app/kbbi.js" ]
36 changes: 5 additions & 31 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,14 @@
#

app = "kbbi-bot-v2"
kill_signal = "SIGINT"
kill_timeout = "5s"
primary_region = "sin"

[build]
builder = "heroku/buildpacks:20"

[env]
NODE_ENV = "production"
PORT = "8080"

[experimental]
auto_rollback = true
cmd = ["node ./dist/app.js"]

[[services]]
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
protocol = "tcp"
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
handlers = ["http"]
port = 80

[[services.ports]]
handlers = ["tls", "http"]
port = 443

[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"

0 comments on commit cdeca6b

Please sign in to comment.