base node + python docker pkg

This commit is contained in:
Kseninia Mikhaylova 2024-05-14 16:01:02 +03:00
commit 1709fd6a2f
14 changed files with 11029 additions and 0 deletions

19
Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM node:22-bookworm-slim
ENV WORKING_DIR=/app
WORKDIR ${WORKING_DIR}
RUN apt-get update
RUN apt-get install python3-pip -y
RUN apt-get install python3-poetry -y
RUN poetry -vvv --version
COPY . ${WORKING_DIR}
COPY pyproject.toml .
RUN cd front && npm run generate
RUN poetry install
RUN poetry run task build
CMD ["poetry", "run", "task", "start"]

6
compose.yml Normal file
View File

@ -0,0 +1,6 @@
services:
web:
build:
dockerfile: Dockerfile
ports:
- 8100:8000

24
front/.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist
# Node dependencies
node_modules
# Logs
logs
*.log
# Misc
.DS_Store
.fleet
.idea
# Local env files
.env
.env.*
!.env.example

75
front/README.md Normal file
View File

@ -0,0 +1,75 @@
# Nuxt 3 Minimal Starter
Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
## Setup
Make sure to install the dependencies:
```bash
# npm
npm install
# pnpm
pnpm install
# yarn
yarn install
# bun
bun install
```
## Development Server
Start the development server on `http://localhost:3000`:
```bash
# npm
npm run dev
# pnpm
pnpm run dev
# yarn
yarn dev
# bun
bun run dev
```
## Production
Build the application for production:
```bash
# npm
npm run build
# pnpm
pnpm run build
# yarn
yarn build
# bun
bun run build
```
Locally preview production build:
```bash
# npm
npm run preview
# pnpm
pnpm run preview
# yarn
yarn preview
# bun
bun run preview
```
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.

5
front/app.vue Normal file
View File

@ -0,0 +1,5 @@
<template>
<div>
<NuxtWelcome />
</div>
</template>

4
front/nuxt.config.ts Normal file
View File

@ -0,0 +1,4 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true }
})

10813
front/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

17
front/package.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "nuxt-app",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"nuxt": "^3.11.2",
"vue": "^3.4.27",
"vue-router": "^4.3.2"
}
}

BIN
front/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,3 @@
{
"extends": "../.nuxt/tsconfig.server.json"
}

4
front/tsconfig.json Normal file
View File

@ -0,0 +1,4 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}

34
main.py Normal file
View File

@ -0,0 +1,34 @@
import requests
import os
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.middleware.cors import CORSMiddleware
import logging
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s %(levelname)s %(filename)s:%(lineno)d %(funcName)s %(message)s",
)
logger = logging.getLogger(__name__)
origins = [
"http://localhost",
"http://localhost:4173",
"http://localhost:5173",
"http://localhost:8000",
]
api_app = FastAPI(title="api app")
app = FastAPI(title="main app")
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.mount("/api", api_app)
app.mount("/", StaticFiles(directory="front/dist", html=True), name="front")

23
pyproject.toml Normal file
View File

@ -0,0 +1,23 @@
[tool.poetry]
name = "service-monitoring"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
readme = "readme.md"
[tool.poetry.dependencies]
python = "^3.10"
fastapi = "^0.111.0"
uvicorn = "^0.29.0"
requests = "^2.31.0"
[tool.poetry.group.dev.dependencies]
taskipy = "^1.0.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.taskipy.tasks]
build = "cd front && npm install && npm run build"
start = "uvicorn main:app --reload --host 0.0.0.0"

2
readme.md Normal file
View File

@ -0,0 +1,2 @@
## Запуск
`docker compose up`