refactor(app): moved main.ts to root of app folder it was doing weird things with ts stuff
This commit is contained in:
@@ -1,19 +1,19 @@
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
import morgan from "morgan";
|
import morgan from "morgan";
|
||||||
import { createServer } from "http";
|
import { createServer } from "http";
|
||||||
import { setupRoutes } from "./internal/routerHandler/routeHandler.js";
|
import { setupRoutes } from "./src/internal/routerHandler/routeHandler.js";
|
||||||
import { printers } from "./internal/ocp/printers/printers.js";
|
import { printers } from "./src/internal/ocp/printers/printers.js";
|
||||||
import { dirname, join } from "path";
|
import { dirname, join } from "path";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
import { db } from "./pkg/db/db.js";
|
import { db } from "./src/pkg/db/db.js";
|
||||||
import { settings } from "./pkg/db/schema/settings.js";
|
import { settings } from "./src/pkg/db/schema/settings.js";
|
||||||
import { validateEnv } from "./pkg/utils/envValidator.js";
|
import { validateEnv } from "./src/pkg/utils/envValidator.js";
|
||||||
import { createLogger } from "./pkg/logger/logger.js";
|
import { createLogger } from "./src/pkg/logger/logger.js";
|
||||||
import { returnFunc } from "./pkg/utils/return.js";
|
import { returnFunc } from "./src/pkg/utils/return.js";
|
||||||
import { initializeProdPool } from "./pkg/prodSql/prodSqlConnect.js";
|
import { initializeProdPool } from "./src/pkg/prodSql/prodSqlConnect.js";
|
||||||
import { tryCatch } from "./pkg/utils/tryCatch.js";
|
import { tryCatch } from "./src/pkg/utils/tryCatch.js";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import { sendNotify } from "./pkg/utils/notify.js";
|
import { sendNotify } from "./src/pkg/utils/notify.js";
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
const env = validateEnv(process.env);
|
const env = validateEnv(process.env);
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
# # ---- Builder Stage ----
|
|
||||||
# FROM golang:1.24.4-alpine3.22 AS builder
|
|
||||||
|
|
||||||
# WORKDIR /app/controller
|
|
||||||
|
|
||||||
# # Copy Go module manifests
|
|
||||||
# COPY controller/go.mod controller/go.sum ./
|
|
||||||
# RUN go mod download
|
|
||||||
|
|
||||||
# # Copy the controller source code
|
|
||||||
# COPY controller/ ./
|
|
||||||
|
|
||||||
# # Build the binary
|
|
||||||
# RUN CGO_ENABLED=0 GOOS=linux go build -o /app/lst_ctl .
|
|
||||||
|
|
||||||
|
|
||||||
# # ---- Runtime Stage ----
|
|
||||||
# FROM alpine:latest
|
|
||||||
|
|
||||||
# WORKDIR /root/
|
|
||||||
|
|
||||||
# # Copy only the binary (no need for sources)
|
|
||||||
# COPY --from=builder /app/lst_ctl .
|
|
||||||
|
|
||||||
# # (Optional) Persist data output if controller writes files
|
|
||||||
# RUN mkdir -p /data
|
|
||||||
# VOLUME /data
|
|
||||||
|
|
||||||
# # Expose Gin API port
|
|
||||||
# EXPOSE 8080
|
|
||||||
|
|
||||||
# ENV RUNNING_IN_DOCKER=true
|
|
||||||
|
|
||||||
# CMD ["./lst_ctl"]
|
|
||||||
|
|
||||||
# ---- Build Go binary ----
|
|
||||||
FROM golang:1.24.4-alpine3.22 AS gobuilder
|
|
||||||
|
|
||||||
WORKDIR /src
|
|
||||||
|
|
||||||
# copy controller module
|
|
||||||
COPY controller/go.mod controller/go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
# copy all controller source code
|
|
||||||
COPY controller/ ./
|
|
||||||
|
|
||||||
# build binary into /bin
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /bin/lst_ctl .
|
|
||||||
|
|
||||||
|
|
||||||
# ---- Runtime with Node ----
|
|
||||||
FROM node:20-alpine
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# copy binary from builder
|
|
||||||
COPY --from=gobuilder /bin/lst_ctl /usr/local/bin/lst_ctl
|
|
||||||
|
|
||||||
# copy repo root into /app (npm needs package.json, dist/, frontend/, etc)
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# clear Node's default entrypoint (Docker Hub node images use ["docker-entrypoint.sh"])
|
|
||||||
ENTRYPOINT []
|
|
||||||
|
|
||||||
# expose gin api
|
|
||||||
EXPOSE 8080
|
|
||||||
ENV RUNNING_IN_DOCKER=true
|
|
||||||
|
|
||||||
# run binary (in PATH now, since it's under /usr/local/bin)
|
|
||||||
CMD ["lst_ctl"]
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
services:
|
|
||||||
controller:
|
|
||||||
build:
|
|
||||||
context: .. # repo root
|
|
||||||
dockerfile: controller/Dockerfile
|
|
||||||
working_dir: /root
|
|
||||||
environment:
|
|
||||||
- RUNNING_IN_DOCKER=true
|
|
||||||
volumes:
|
|
||||||
- ..:/app # mount repo root for zipping, etc.
|
|
||||||
- ../builds:/builds # clean host->container builds mapping
|
|
||||||
ports:
|
|
||||||
- "8080:8080"
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"dev:app": "dotenvx run -f .env -- tsx watch app/src/main.ts",
|
"dev:app": "dotenvx run -f .env -- tsx watch app/main.ts",
|
||||||
"dev:docs": "npm run translateDocs && cd lstDocs && npm start",
|
"dev:docs": "npm run translateDocs && cd lstDocs && npm start",
|
||||||
"dev:front": "cd frontend && npm run dev",
|
"dev:front": "cd frontend && npm run dev",
|
||||||
"dev:db:migrate": "npx drizzle-kit push --config=drizzle-dev.config.ts",
|
"dev:db:migrate": "npx drizzle-kit push --config=drizzle-dev.config.ts",
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"app/src",
|
"app/src",
|
||||||
"database/testFiles/test-tiPostOrders.ts",
|
"database/testFiles/test-tiPostOrders.ts",
|
||||||
"scripts/translateScript.js"
|
"scripts/translateScript.js",
|
||||||
|
"app/main.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|||||||
Reference in New Issue
Block a user