docker
This commit is contained in:
@ -1 +1,7 @@
|
||||
.git
|
||||
.mysql
|
||||
dist
|
||||
node_modules
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
sous-podzim2024-app.tar.gz
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
node_modules
|
||||
.mysql
|
||||
dist
|
||||
node_modules
|
||||
sous-podzim2024-app.tar.gz
|
||||
|
||||
17
Dockerfile
17
Dockerfile
@ -1,16 +1,17 @@
|
||||
FROM oven/bun:1 AS base
|
||||
FROM oven/bun:1 AS builder
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package.json bun.lockb .
|
||||
#RUN bun install --frozen-lockfile --production
|
||||
RUN bun install --frozen-lockfile --development
|
||||
RUN bun install --frozen-lockfile --production
|
||||
|
||||
COPY . .
|
||||
RUN bun run build
|
||||
|
||||
#ENV NODE_ENV=production
|
||||
ENV NODE_ENV=development
|
||||
FROM node:22-alpine AS base
|
||||
WORKDIR /usr/src/app
|
||||
COPY --from=builder /usr/src/app .
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
USER bun
|
||||
EXPOSE 8080/tcp
|
||||
#ENTRYPOINT [ "bun", "run", "src/index.ts" ]
|
||||
ENTRYPOINT [ "bun", "run", "dev" ]
|
||||
ENTRYPOINT [ "node", "./dist/index.js" ]
|
||||
|
||||
@ -12,4 +12,8 @@ To run:
|
||||
bun run index.ts
|
||||
```
|
||||
|
||||
This project was created using `bun init` in bun v1.1.12. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
||||
# transfer to server
|
||||
build image with `docker compose build`
|
||||
save image to file on client: `docker save sous-podzim2024-app:latest | gzip > sous-podzim2024-app.tar.gz`
|
||||
copy zip to server
|
||||
load image on server: `docker load < sous-podzim2024-app.tar.gz`
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
services:
|
||||
app:
|
||||
image: labyrint
|
||||
image: sous-podzim2024-app
|
||||
build:
|
||||
context: .
|
||||
restart: on-failure:3
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
import { defineConfig } from "drizzle-kit";
|
||||
|
||||
export const dbCredentials = {
|
||||
//host: "127.0.0.1",
|
||||
host: "db",
|
||||
//port: 8081,
|
||||
port: 3306,
|
||||
user: "root",
|
||||
password: "password",
|
||||
user: "fykosak",
|
||||
password: "zxvFcEztX0vzDhB",
|
||||
database: "sous-podzim2024-app"
|
||||
};
|
||||
|
||||
|
||||
47
package.json
47
package.json
@ -1,26 +1,25 @@
|
||||
{
|
||||
"name": "sous-podzim2024-app",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@types/bun": "latest"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/ejs": "^3.1.5",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/multer": "^1.4.12",
|
||||
"drizzle-kit": "^0.24.2",
|
||||
"drizzle-orm": "^0.33.0",
|
||||
"ejs": "^3.1.10",
|
||||
"express": "^4.19.2",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"mysql2": "^3.11.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "bun --watch src/index.ts",
|
||||
"push": "bun drizzle-kit push"
|
||||
}
|
||||
"name": "sous-podzim2024-app",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@types/bun": "latest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/ejs": "^3.1.5",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/multer": "^1.4.12",
|
||||
"drizzle-kit": "^0.24.2",
|
||||
"drizzle-orm": "^0.33.0",
|
||||
"ejs": "^3.1.10",
|
||||
"express": "^4.19.2",
|
||||
"typescript": "^5.6.2",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"mysql2": "^3.11.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "bun --watch src/index.ts",
|
||||
"push": "bun drizzle-kit push",
|
||||
"build": "bun build ./src/index.ts --outdir ./dist --target node"
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ export const personRelations = relations(personTable, ({ many }) => ({
|
||||
export const pointsTable = mysqlTable('points', {
|
||||
pointsId: int('pointsId').primaryKey().autoincrement(),
|
||||
personId: int('personId').notNull().references(() => personTable.personId),
|
||||
points: int('points'),
|
||||
points: int('points').notNull(),
|
||||
});
|
||||
|
||||
export const pointsRelations = relations(pointsTable, ({ one }) => ({
|
||||
|
||||
@ -88,6 +88,7 @@ app.get("/gamble/:id", async (req, res) => {
|
||||
|
||||
if (isDetailAvailable(person.gambleTime)) {
|
||||
res.redirect('/person/' + id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isGambleAvailable(person.gambleTime)) {
|
||||
|
||||
Reference in New Issue
Block a user