Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

update docker and change api path

Carl-Gerhard Lindesvärd2a99eee71c13
diff --git a/.dockerignore b/.dockerignore
index 1c7f79b73..56c441207 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,2 +1,3 @@
**/.env
**/node_modules
+**/dist
diff --git a/apps/backend/Dockerfile b/apps/backend/Dockerfile
index ea6210404..4f2504202 100644
--- a/apps/backend/Dockerfile
+++ b/apps/backend/Dockerfile
@@ -1,12 +1,8 @@
-FROM --platform=linux/amd64 oven/bun:1.0.5-slim
+FROM --platform=linux/amd64 oven/bun:1.0.5-slim as builder
ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL
-ENV PORT=3000
-
-ENV NODE_ENV=production
-
# For prisma
ARG NODE_VERSION=18
RUN apt update \
@@ -23,10 +19,9 @@ COPY packages/types/package.json packages/types/package.json
COPY bun.lockb bun.lockb
RUN bun install
COPY . .
-
WORKDIR /app/apps/backend
RUN bunx prisma generate
-
+WORKDIR /app/apps/backend
EXPOSE ${PORT}
CMD ["bun", "start"]
diff --git a/apps/backend/src/app.ts b/apps/backend/src/app.ts
index 2cc04a7fc..10ab602cc 100644
--- a/apps/backend/src/app.ts
+++ b/apps/backend/src/app.ts
@@ -4,18 +4,15 @@ import profiles from './routes/profiles'
import { authMiddleware } from "./middlewares/auth";
import morgan from 'morgan'
-
const app = express();
const port = process.env.PORT || 8080;
-app.use(morgan('tiny'))
-app.use(express.json());
app.use(express.json());
+app.use(morgan(':method :url :status :response-time ms'))
+app.get("/", (req, res) => res.json("Welcome to Mixan"));
app.use(authMiddleware)
-app.use(events)
-app.use(profiles)
-app.get("/ping", (req, res) => res.json("pong"));
-
+app.use('/api/sdk',events)
+app.use('/api/sdk',profiles)
app.listen(port, () => {
console.log(`Listening on port ${port}...`);
});
\ No newline at end of file