Merge branch 'main' into schedule-nms-in-ntfcts-and-lgs
This commit is contained in:
commit
503f4e2636
4 changed files with 16 additions and 6 deletions
|
|
@ -3,7 +3,9 @@ ARG BUN_VERSION="1.3.5"
|
||||||
FROM oven/bun:${BUN_VERSION}-alpine AS base
|
FROM oven/bun:${BUN_VERSION}-alpine AS base
|
||||||
|
|
||||||
RUN apk upgrade --no-cache && \
|
RUN apk upgrade --no-cache && \
|
||||||
apk add --no-cache davfs2=1.6.1-r2 openssh-client fuse3 sshfs
|
apk add --no-cache davfs2=1.6.1-r2 openssh-client fuse3 sshfs tini
|
||||||
|
|
||||||
|
ENTRYPOINT ["/sbin/tini", "-s", "--"]
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
|
|
@ -64,7 +66,7 @@ CMD ["bun", "run", "dev"]
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
# PRODUCTION
|
# PRODUCTION
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
FROM oven/bun:${BUN_VERSION} AS builder
|
FROM oven/bun:${BUN_VERSION}-alpine AS builder
|
||||||
|
|
||||||
ARG APP_VERSION=dev
|
ARG APP_VERSION=dev
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,16 @@ const envSchema = type({
|
||||||
SERVER_IP: 'string = "localhost"',
|
SERVER_IP: 'string = "localhost"',
|
||||||
SERVER_IDLE_TIMEOUT: 'string.integer.parse = "60"',
|
SERVER_IDLE_TIMEOUT: 'string.integer.parse = "60"',
|
||||||
RESTIC_HOSTNAME: "string = 'zerobyte'",
|
RESTIC_HOSTNAME: "string = 'zerobyte'",
|
||||||
|
PORT: 'string.integer.parse = "4096"',
|
||||||
|
MIGRATIONS_PATH: "string?",
|
||||||
}).pipe((s) => ({
|
}).pipe((s) => ({
|
||||||
__prod__: s.NODE_ENV === "production",
|
__prod__: s.NODE_ENV === "production",
|
||||||
environment: s.NODE_ENV,
|
environment: s.NODE_ENV,
|
||||||
serverIp: s.SERVER_IP,
|
serverIp: s.SERVER_IP,
|
||||||
serverIdleTimeout: s.SERVER_IDLE_TIMEOUT,
|
serverIdleTimeout: s.SERVER_IDLE_TIMEOUT,
|
||||||
resticHostname: s.RESTIC_HOSTNAME,
|
resticHostname: s.RESTIC_HOSTNAME,
|
||||||
|
port: s.PORT,
|
||||||
|
migrationsPath: s.MIGRATIONS_PATH,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const parseConfig = (env: unknown) => {
|
const parseConfig = (env: unknown) => {
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,13 @@ const sqlite = new Database(DATABASE_URL);
|
||||||
export const db = drizzle({ client: sqlite, schema });
|
export const db = drizzle({ client: sqlite, schema });
|
||||||
|
|
||||||
export const runDbMigrations = () => {
|
export const runDbMigrations = () => {
|
||||||
let migrationsFolder = path.join("/app", "assets", "migrations");
|
let migrationsFolder: string;
|
||||||
|
|
||||||
if (!config.__prod__) {
|
if (config.migrationsPath) {
|
||||||
|
migrationsFolder = config.migrationsPath;
|
||||||
|
} else if (config.__prod__) {
|
||||||
|
migrationsFolder = path.join("/app", "assets", "migrations");
|
||||||
|
} else {
|
||||||
migrationsFolder = path.join("/app", "app", "drizzle");
|
migrationsFolder = path.join("/app", "app", "drizzle");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ await validateRequiredMigrations(REQUIRED_MIGRATIONS);
|
||||||
|
|
||||||
startup();
|
startup();
|
||||||
|
|
||||||
logger.info(`Server is running at http://localhost:4096`);
|
logger.info(`Server is running at http://localhost:${config.port}`);
|
||||||
|
|
||||||
export type AppType = typeof app;
|
export type AppType = typeof app;
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ process.on("SIGINT", async () => {
|
||||||
|
|
||||||
export default await createHonoServer({
|
export default await createHonoServer({
|
||||||
app,
|
app,
|
||||||
port: 4096,
|
port: config.port,
|
||||||
customBunServer: {
|
customBunServer: {
|
||||||
idleTimeout: config.serverIdleTimeout,
|
idleTimeout: config.serverIdleTimeout,
|
||||||
error(err) {
|
error(err) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue