-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
142 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
dist | ||
.env | ||
.env.production | ||
drizzle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
dist | ||
.env | ||
.env.production | ||
drizzle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,46 @@ | ||
FROM oven/bun AS builder | ||
# syntax = docker/dockerfile:1 | ||
|
||
WORKDIR /src | ||
# Adjust BUN_VERSION as desired | ||
ARG BUN_VERSION=1.0.2 | ||
FROM oven/bun:${BUN_VERSION} as base | ||
|
||
COPY . . | ||
LABEL fly_launch_runtime="Bun" | ||
|
||
ENV NODE_ENV=production | ||
# Bun app lives here | ||
WORKDIR /app | ||
|
||
RUN bun i && \ | ||
bun run generate && \ | ||
bun build --target bun --outfile dist/kbbi.js ./src/main.ts | ||
# Set production environment | ||
ENV NODE_ENV="production" | ||
|
||
FROM oven/bun | ||
|
||
WORKDIR /app | ||
# Throw-away build stage to reduce size of final image | ||
FROM base as build | ||
|
||
# Install packages needed to build node modules | ||
RUN apt-get update -qq && \ | ||
apt-get install -y build-essential pkg-config python-is-python3 | ||
|
||
# Install node modules | ||
COPY --link bun.lockb package.json ./ | ||
RUN bun install | ||
|
||
# Copy application code | ||
COPY --link . . | ||
|
||
# Build application | ||
RUN bun run generate | ||
|
||
# Remove development dependencies | ||
RUN rm -rf node_modules && \ | ||
bun install --ci | ||
|
||
|
||
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 | ||
# Final stage for app image | ||
FROM base | ||
|
||
RUN bun i -p | ||
# Copy built application | ||
COPY --from=build /app /app | ||
|
||
ENTRYPOINT [ "bun", "run", "/app/kbbi.js" ] | ||
# Start the server by default, this can be overwritten at runtime | ||
EXPOSE 3000 | ||
CMD [ "bun", "run", "src/main.ts" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
schema: './src/db/postgres/schemas/*', | ||
out: './drizzle', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
# fly.toml app configuration file generated for kbbi-bot on 2023-09-26T17:57:06+07:00 | ||
# fly.toml app configuration file generated for kbbi-bot-v3 on 2023-09-26T19:48:53+07:00 | ||
# | ||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | ||
# | ||
|
||
app = "kbbi-bot" | ||
app = "kbbi-bot-v3" | ||
primary_region = "sin" | ||
|
||
[build] | ||
|
||
[http_service] | ||
internal_port = 3000 | ||
force_https = true | ||
auto_stop_machines = true | ||
auto_start_machines = true | ||
min_machines_running = 0 | ||
processes = ["app"] | ||
internal_port = 8080 | ||
force_https = true | ||
auto_stop_machines = false | ||
auto_start_machines = true | ||
min_machines_running = 0 | ||
processes = ["app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.