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