Compare commits
4 Commits
renovate/a
...
main
Author | SHA1 | Date | |
---|---|---|---|
3c9b8ba3f9 | |||
8f685e923e | |||
2219ad209d | |||
ded175cdd2 |
107
.gitea/workflows/build.yaml
Normal file
107
.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
name: Build & Publish Backend
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- "api/**"
|
||||||
|
- "frontend/**"
|
||||||
|
- "telegram_bot/**"
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Check changed directories
|
||||||
|
uses: https://github.com/dorny/paths-filter@v2
|
||||||
|
id: changes
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
api:
|
||||||
|
- 'api/**'
|
||||||
|
frontend:
|
||||||
|
- 'frontend/**'
|
||||||
|
telegram_bot:
|
||||||
|
- 'telegram_bot/**'
|
||||||
|
|
||||||
|
# Frontend
|
||||||
|
- name: "[Frontend] Docker meta"
|
||||||
|
if: steps.changes.outputs.frontend == 'true'
|
||||||
|
id: frontend-meta
|
||||||
|
uses: https://github.com/docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: git.flokaiser.com/dhbw/aktienbot-frontend
|
||||||
|
tags: |
|
||||||
|
type=sha,enable=true,priority=100,prefix={{branch}}-,suffix=,format=short
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
|
# API
|
||||||
|
- name: "[API] Docker meta"
|
||||||
|
if: steps.changes.outputs.api == 'true'
|
||||||
|
id: api-meta
|
||||||
|
uses: https://github.com/docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: git.flokaiser.com/dhbw/aktienbot-api
|
||||||
|
tags: |
|
||||||
|
type=sha,enable=true,priority=100,prefix={{branch}}-,suffix=,format=short
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
|
# Bot
|
||||||
|
- name: "[Bot] Docker meta"
|
||||||
|
if: steps.changes.outputs.telegram_bot == 'true'
|
||||||
|
id: bot-meta
|
||||||
|
uses: https://github.com/docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: git.flokaiser.com/dhbw/aktienbot-bot
|
||||||
|
tags: |
|
||||||
|
type=sha,enable=true,priority=100,prefix={{branch}}-,suffix=,format=short
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
|
- name: Get get-docker.sh
|
||||||
|
run: curl -fsSL https://get.docker.com -o get-docker.sh
|
||||||
|
|
||||||
|
- name: Install docker
|
||||||
|
run: sh get-docker.sh
|
||||||
|
|
||||||
|
- name: Login to Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: git.flokaiser.com
|
||||||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
# Frontend
|
||||||
|
- name: "[Frontend] Build and push"
|
||||||
|
if: steps.changes.outputs.frontend == 'true'
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
file: Dockerfile
|
||||||
|
context: "{{defaultContext}}:frontend"
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.frontend-meta.outputs.tags }}
|
||||||
|
|
||||||
|
# API
|
||||||
|
- name: "[API] Build and push"
|
||||||
|
if: steps.changes.outputs.api == 'true'
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
file: Dockerfile
|
||||||
|
context: "{{defaultContext}}:api"
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.api-meta.outputs.tags }}
|
||||||
|
|
||||||
|
# Bot
|
||||||
|
- name: "[Bot] Build and push"
|
||||||
|
if: steps.changes.outputs.telegram_bot == 'true'
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
file: Dockerfile
|
||||||
|
context: "{{defaultContext}}:telegram_bot"
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.bot-meta.outputs.tags }}
|
@ -1,87 +0,0 @@
|
|||||||
pipeline:
|
|
||||||
generate_docker_tag:
|
|
||||||
image: golang
|
|
||||||
commands:
|
|
||||||
- echo -n "${CI_COMMIT_BRANCH//\//-}-${CI_COMMIT_SHA:0:8}, latest" > .tags
|
|
||||||
when:
|
|
||||||
path: [ "frontend/**", "telegram_bot/**", "api/**" ]
|
|
||||||
event: push
|
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------- API --------------------------------------
|
|
||||||
build_api:
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
settings:
|
|
||||||
repo:
|
|
||||||
from_secret: repo_api
|
|
||||||
username:
|
|
||||||
from_secret: username
|
|
||||||
password:
|
|
||||||
from_secret: password
|
|
||||||
registry:
|
|
||||||
from_secret: registry
|
|
||||||
dockerfile: api/Dockerfile
|
|
||||||
platforms: linux/amd64
|
|
||||||
when:
|
|
||||||
path: "api/**"
|
|
||||||
event: push
|
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------- Bot --------------------------------------
|
|
||||||
build_bot:
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
settings:
|
|
||||||
repo:
|
|
||||||
from_secret: repo_bot
|
|
||||||
username:
|
|
||||||
from_secret: username
|
|
||||||
password:
|
|
||||||
from_secret: password
|
|
||||||
registry:
|
|
||||||
from_secret: registry
|
|
||||||
dockerfile: telegram_bot/Dockerfile
|
|
||||||
platforms: linux/amd64
|
|
||||||
when:
|
|
||||||
path: "telegram_bot/**"
|
|
||||||
event: push
|
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------- Frontend --------------------------------------
|
|
||||||
build_frontend:
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
settings:
|
|
||||||
repo:
|
|
||||||
from_secret: repo_frontend
|
|
||||||
username:
|
|
||||||
from_secret: username
|
|
||||||
password:
|
|
||||||
from_secret: password
|
|
||||||
registry:
|
|
||||||
from_secret: registry
|
|
||||||
dockerfile: frontend/Dockerfile
|
|
||||||
platforms: linux/amd64
|
|
||||||
when:
|
|
||||||
path: "frontend/**"
|
|
||||||
event: push
|
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------- Deploy --------------------------------------
|
|
||||||
deploy:
|
|
||||||
image: appleboy/drone-ssh
|
|
||||||
network_mode: host
|
|
||||||
settings:
|
|
||||||
host:
|
|
||||||
from_secret: ssh_host
|
|
||||||
username:
|
|
||||||
from_secret: ssh_user
|
|
||||||
password:
|
|
||||||
from_secret: ssh_password
|
|
||||||
script:
|
|
||||||
- cd ~/docker-compose-files/telegram_aktien_bot
|
|
||||||
- docker-compose pull
|
|
||||||
- docker-compose --env-file ~/docker-compose-env/telegram_aktien_bot.env up -d
|
|
||||||
when:
|
|
||||||
path: [ "frontend/**", "telegram_bot/**", "api/**" ]
|
|
||||||
event: push
|
|
||||||
|
|
||||||
branches: main
|
|
@ -1,4 +1,3 @@
|
|||||||
[![Build Status](https://gitea.woodpecker.flokaiser.com/api/badges/DHBW/TelegramAktienBot/status.svg)](https://gitea.woodpecker.flokaiser.com/DHBW/TelegramAktienBot)
|
|
||||||
# TelegramAktienBot
|
# TelegramAktienBot
|
||||||
WebEngineering2 Projekt: Aktien und News Bot für Telegram
|
WebEngineering2 Projekt: Aktien und News Bot für Telegram
|
||||||
|
|
||||||
|
@ -7,12 +7,12 @@ WORKDIR /srv/flask_app
|
|||||||
RUN apt update && apt install -y python3 python3-pip curl nginx && rm -rf /var/lib/apt/lists/*
|
RUN apt update && apt install -y python3 python3-pip curl nginx && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install the dependencies
|
# Install the dependencies
|
||||||
COPY api/requirements.txt /srv/flask_app/
|
COPY requirements.txt /srv/flask_app/
|
||||||
RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-location
|
RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-location
|
||||||
|
|
||||||
# Copy the source code to the working directory
|
# Copy the source code to the working directory
|
||||||
COPY api /srv/flask_app
|
COPY . /srv/flask_app
|
||||||
COPY api/deploy/nginx.conf /etc/nginx
|
COPY ./deploy/nginx.conf /etc/nginx
|
||||||
|
|
||||||
# Change file permissions
|
# Change file permissions
|
||||||
RUN chmod +x ./deploy/start.sh
|
RUN chmod +x ./deploy/start.sh
|
||||||
|
@ -49,7 +49,7 @@ docker run -d \
|
|||||||
--env "MYSQL_PORT=" \
|
--env "MYSQL_PORT=" \
|
||||||
--env "MYSQL_DATABASE=" \
|
--env "MYSQL_DATABASE=" \
|
||||||
--restart unless-stopped \
|
--restart unless-stopped \
|
||||||
registry.flokaiser.com/aktienbot/api:latest
|
git.flokaiser.com/dhbw/aktienbot-api:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
or load environment variables from file by using `--env-file <filename>`
|
or load environment variables from file by using `--env-file <filename>`
|
@ -7,6 +7,6 @@ __version__ = "1.0.0"
|
|||||||
from app import create_app
|
from app import create_app
|
||||||
|
|
||||||
|
|
||||||
# Create an application instance that web servers can use.
|
|
||||||
application = create_app('config/flask.cfg')
|
application = create_app('config/flask.cfg')
|
||||||
application.run()
|
application.run()
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
Flask~=2.1.2
|
Flask==2.2.3
|
||||||
python-dotenv==0.21.0
|
python-dotenv==1.0.0
|
||||||
uwsgi==2.0.21
|
uwsgi==2.0.21
|
||||||
Flask_SQLAlchemy==3.0.2
|
Flask_SQLAlchemy==3.0.3
|
||||||
python-dotenv==0.21.0
|
|
||||||
pymysql==1.0.2
|
pymysql==1.0.2
|
||||||
pyjwt==2.6.0
|
pyjwt==2.6.0
|
||||||
apiflask==1.0.0
|
apiflask==1.3.1
|
||||||
flask-cors==3.0.10
|
flask-cors==3.0.10
|
||||||
bcrypt==4.0.1
|
bcrypt==4.0.1
|
||||||
pytest~=7.2.0
|
pytest==7.2.2
|
||||||
pytest-cov
|
pytest-cov==4.0.
|
||||||
marshmallow~=3.19.0
|
marshmallow==3.19.0
|
||||||
faker~=15.3.4
|
faker==18.3.1
|
||||||
requests~=2.28.1
|
requests==2.28.1
|
||||||
investpy~=1.0.8
|
investpy==1.0.8
|
||||||
pandas~=1.5.0
|
pandas==1.5.3
|
||||||
currencyconverter~=0.17.1
|
currencyconverter==0.17.6
|
@ -1,10 +1,10 @@
|
|||||||
FROM node:latest as build
|
FROM node:18 as build
|
||||||
|
|
||||||
# Change to the project directory
|
# Change to the project directory
|
||||||
WORKDIR /usr/local/app
|
WORKDIR /usr/local/app
|
||||||
|
|
||||||
# Copy the project files to the container
|
# Copy the project files to the container
|
||||||
COPY frontend/ /usr/local/app/
|
COPY . /usr/local/app/
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN npm install
|
RUN npm install
|
||||||
@ -16,8 +16,8 @@ FROM nginx:latest
|
|||||||
COPY --from=build /usr/local/app/dist/aktienbot /usr/share/nginx/html
|
COPY --from=build /usr/local/app/dist/aktienbot /usr/share/nginx/html
|
||||||
|
|
||||||
# Copy configuration files
|
# Copy configuration files
|
||||||
COPY frontend/deploy/nginx.conf /etc/nginx
|
COPY ./deploy/nginx.conf /etc/nginx
|
||||||
COPY frontend/deploy deploy/
|
COPY ./deploy deploy/
|
||||||
|
|
||||||
# Change file permissions
|
# Change file permissions
|
||||||
RUN chmod +x ./deploy/healthcheck.sh
|
RUN chmod +x ./deploy/healthcheck.sh
|
||||||
|
11259
frontend/package-lock.json
generated
11259
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,50 +4,50 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build --configuration production --build-optimizer",
|
"build": "ng build --prod --build-optimizer",
|
||||||
"watch": "ng build --configuration development --watch",
|
"watch": "ng build --watch --configuration development",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"compodoc": "npx compodoc -p tsconfig.doc.json"
|
"compodoc": "npx compodoc -p tsconfig.doc.json"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "~15.0.0",
|
"@angular/animations": "~13.2.0",
|
||||||
"@angular/cdk": "^15.0.0",
|
"@angular/cdk": "~13.2.6",
|
||||||
"@angular/common": "~15.0.0",
|
"@angular/common": "~13.2.0",
|
||||||
"@angular/compiler": "~15.0.0",
|
"@angular/compiler": "~13.2.0",
|
||||||
"@angular/core": "~15.0.0",
|
"@angular/core": "~13.2.0",
|
||||||
"@angular/forms": "~15.0.0",
|
"@angular/forms": "~13.2.0",
|
||||||
"@angular/material": "^15.0.0",
|
"@angular/material": "13.2.6",
|
||||||
"@angular/platform-browser": "~15.0.0",
|
"@angular/platform-browser": "~13.2.0",
|
||||||
"@angular/platform-browser-dynamic": "~15.2.0",
|
"@angular/platform-browser-dynamic": "~13.2.0",
|
||||||
"@angular/router": "~15.0.0",
|
"@angular/router": "~13.2.0",
|
||||||
"bootstrap": "^5.1.3",
|
"bootstrap": "5.1.3",
|
||||||
"ngx-cron-editor": "^0.7.3",
|
"ngx-cron-editor": "0.7.3",
|
||||||
"rxjs": "~7.6.0",
|
"rxjs": "~7.5.0",
|
||||||
"tslib": "^2.4.0",
|
"tslib": "2.4.0",
|
||||||
"zone.js": "~0.12.0"
|
"zone.js": "~0.11.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "~15.0.0",
|
"@angular-devkit/build-angular": "~13.3.5",
|
||||||
"@angular-eslint/builder": "15.1.0",
|
"@angular-eslint/builder": "13.2.1",
|
||||||
"@angular-eslint/eslint-plugin": "15.1.0",
|
"@angular-eslint/eslint-plugin": "13.2.1",
|
||||||
"@angular-eslint/eslint-plugin-template": "15.1.0",
|
"@angular-eslint/eslint-plugin-template": "13.2.1",
|
||||||
"@angular-eslint/schematics": "15.1.0",
|
"@angular-eslint/schematics": "13.2.1",
|
||||||
"@angular-eslint/template-parser": "15.1.0",
|
"@angular-eslint/template-parser": "13.2.1",
|
||||||
"@angular/cli": "~15.0.0",
|
"@angular/cli": "~13.3.5",
|
||||||
"@angular/compiler-cli": "~15.0.0",
|
"@angular/compiler-cli": "~13.2.0",
|
||||||
"@types/jasmine": "~4.3.0",
|
"@types/jasmine": "~4.0.3",
|
||||||
"@types/node": "^18.0.0",
|
"@types/node": "^12.11.1",
|
||||||
"@typescript-eslint/eslint-plugin": "5.46.1",
|
"@typescript-eslint/eslint-plugin": "5.23.0",
|
||||||
"@typescript-eslint/parser": "5.46.1",
|
"@typescript-eslint/parser": "5.22.0",
|
||||||
"eslint": "^8.15.0",
|
"eslint": "^8.15.0",
|
||||||
"jasmine-core": "~4.5.0",
|
"jasmine-core": "~4.1.0",
|
||||||
"karma": "~6.4.0",
|
"karma": "~6.3.19",
|
||||||
"karma-chrome-launcher": "~3.1.0",
|
"karma-chrome-launcher": "~3.1.0",
|
||||||
"karma-coverage": "~2.2.0",
|
"karma-coverage": "~2.2.0",
|
||||||
"karma-jasmine": "~5.1.0",
|
"karma-jasmine": "~5.0.0",
|
||||||
"karma-jasmine-html-reporter": "~2.0.0",
|
"karma-jasmine-html-reporter": "~1.7.0",
|
||||||
"typescript": "~4.9.0"
|
"typescript": "~4.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,16 @@ FROM python:3.11-slim
|
|||||||
# Change the working directory to the root of the project
|
# Change the working directory to the root of the project
|
||||||
WORKDIR /srv/flask_app
|
WORKDIR /srv/flask_app
|
||||||
|
|
||||||
|
# Create venv
|
||||||
|
RUN python -m venv myvenv
|
||||||
|
ENV PATH="myvenv/bin:$PATH"
|
||||||
|
|
||||||
# Install the dependencies
|
# Install the dependencies
|
||||||
COPY telegram_bot/requirements.txt /srv/flask_app/
|
COPY requirements.txt /srv/flask_app/
|
||||||
RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-location
|
RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-location
|
||||||
|
|
||||||
# Copy the source code to the working directory
|
# Copy the source code to the working directory
|
||||||
COPY telegram_bot /srv/flask_app
|
COPY . /srv/flask_app
|
||||||
|
|
||||||
# Change file permissions
|
# Change file permissions
|
||||||
RUN chmod +x ./deploy/start.sh
|
RUN chmod +x ./deploy/start.sh
|
||||||
|
@ -32,7 +32,7 @@ docker run -d \
|
|||||||
--env "BOT_API_KEY=" \
|
--env "BOT_API_KEY=" \
|
||||||
--env "NEWS_API_KEY=" \
|
--env "NEWS_API_KEY=" \
|
||||||
--restart unless-stopped \
|
--restart unless-stopped \
|
||||||
registry.flokaiser.com/aktienbot/bot:latest
|
git.flokaiser.com/dhbw/aktienbot-bot:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
or load environment variables from file by using `--env-file <filename>`
|
or load environment variables from file by using `--env-file <filename>`
|
||||||
|
Loading…
Reference in New Issue
Block a user