diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
new file mode 100644
index 0000000..0ae4d62
--- /dev/null
+++ b/.github/workflows/main.yaml
@@ -0,0 +1,137 @@
+name: Build and deploy
+
+on:
+ push:
+ branches:
+ - 'main'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Notify Telegram start building
+ uses: appleboy/telegram-action@master
+ with:
+ to: ${{ secrets.TELEGRAM_CHAT_ID }}
+ token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
+ message: |
+ π ΠΠ°ΠΏΡΡΠΊ ΡΠ±ΠΎΡΠΊΠΈ!
+ Π‘Π΅ΡΠ²Π΅Ρ: ${{ secrets.SERVER_NAME }}
+ Π Π΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ: ${{ github.repository }}
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Login to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Build and push
+ uses: docker/build-push-action@v5
+ with:
+ push: true
+ tags: smallbuster/ocenka-web:latest
+ build-args: |
+ NEXT_PUBLIC_MAIL_USER=${{ secrets.NEXT_PUBLIC_MAIL_USER }}
+ NEXT_PUBLIC_MAIL_PASS=${{ secrets.NEXT_PUBLIC_MAIL_PASS }}
+ NEXT_PUBLIC_MAIL_FROM=${{ secrets.NEXT_PUBLIC_MAIL_FROM }}
+ NEXT_PUBLIC_MAIL_TO=${{ secrets.NEXT_PUBLIC_MAIL_TO }}
+ NEXT_PUBLIC_MAIL_SECURE_KEY=${{ secrets.NEXT_PUBLIC_MAIL_SECURE_KEY }}
+
+ - name: Notify Telegram about success
+ if: success()
+ uses: appleboy/telegram-action@master
+ with:
+ to: ${{ secrets.TELEGRAM_CHAT_ID }}
+ token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
+ message: |
+ β
Π‘Π±ΠΎΡΠΊΠ° ΡΡΠΏΠ΅ΡΠ½ΠΎ Π·Π°Π²Π΅ΡΡΠ΅Π½Π°!
+ Π‘Π΅ΡΠ²Π΅Ρ: ${{ secrets.SERVER_NAME }}
+ Π Π΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ: ${{ github.repository }}
+ ΠΠ΅ΡΠΊΠ°: ${{ github.ref_name }}
+ ΠΠΎΠΌΠΌΠΈΡ: ${{ github.sha }}
+
+ - name: Notify Telegram about failure
+ if: failure()
+ uses: appleboy/telegram-action@master
+ with:
+ to: ${{ secrets.TELEGRAM_CHAT_ID }}
+ token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
+ message: |
+ β Π‘Π±ΠΎΡΠΊΠ° ΠΏΡΠΎΠ΅ΠΊΡΠ° Π½Π΅ΡΠ΄Π°ΡΠ½Π°!
+ Π‘Π΅ΡΠ²Π΅Ρ: ${{ secrets.SERVER_NAME }}
+ Π Π΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ: ${{ github.repository }}
+ ΠΠ΅ΡΠΊΠ°: ${{ github.ref_name }}
+ ΠΠΎΠΌΠΌΠΈΡ: ${{ github.sha }}
+ ΠΠΎΠ΄ΡΠΎΠ±Π½ΠΎΡΡΠΈ: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
+
+ deploy:
+ runs-on: self-hosted
+ needs: build
+ steps:
+ - name: Notify Telegram start deploy
+ uses: appleboy/telegram-action@master
+ with:
+ to: ${{ secrets.TELEGRAM_CHAT_ID }}
+ token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
+ message: |
+ π³ ΠΠ°ΠΏΡΡΠΊ Π΄Π΅ΠΏΠ»ΠΎΡ!
+ Π‘Π΅ΡΠ²Π΅Ρ: ${{ secrets.SERVER_NAME }}
+ Π Π΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ: ${{ github.repository }}
+
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Login to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Set up Docker Compose
+ run: |
+ docker compose version
+
+ - name: Stop and remove existing containers
+ run: |
+ docker compose -f docker-compose.yaml down || true
+
+ - name: Pull Docker images
+ run: |
+ docker compose -f docker-compose.yaml pull
+
+ - name: Start containers
+ run: |
+ docker compose -f docker-compose.yaml up -d
+
+ - name: Notify Telegram about success
+ if: success()
+ uses: appleboy/telegram-action@master
+ with:
+ to: ${{ secrets.TELEGRAM_CHAT_ID }}
+ token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
+ message: |
+ β
ΠΠ΅ΠΏΠ»ΠΎΠΉ ΡΡΠΏΠ΅ΡΠ½ΠΎ Π·Π°Π²Π΅ΡΡΠ΅Π½!
+ Π‘Π΅ΡΠ²Π΅Ρ: ${{ secrets.SERVER_NAME }}
+ Π Π΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ: ${{ github.repository }}
+ ΠΠ΅ΡΠΊΠ°: ${{ github.ref_name }}
+ ΠΠΎΠΌΠΌΠΈΡ: ${{ github.sha }}
+
+ - name: Notify Telegram about failure
+ if: failure()
+ uses: appleboy/telegram-action@master
+ with:
+ to: ${{ secrets.TELEGRAM_CHAT_ID }}
+ token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
+ message: |
+ β ΠΠ΅ΠΏΠ»ΠΎΠΉ Π½Π΅ ΡΠ΄Π°Π»ΡΡ!
+ Π‘Π΅ΡΠ²Π΅Ρ: ${{ secrets.SERVER_NAME }}
+ Π Π΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ: ${{ github.repository }}
+ ΠΠ΅ΡΠΊΠ°: ${{ github.ref_name }}
+ ΠΠΎΠΌΠΌΠΈΡ: ${{ github.sha }}
+ ΠΠΎΠ΄ΡΠΎΠ±Π½ΠΎΡΡΠΈ: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..e6ef4f3
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e3284a3..d01f065 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,26 +5,10 @@
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -32,7 +16,7 @@
-
+
@@ -60,32 +44,35 @@
- {
- "keyToString": {
- "ModuleVcsDetector.initialDetectionPerformed": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
- "RunOnceActivity.git.unshallow": "true",
- "com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true",
- "git-widget-placeholder": "dev",
- "ignore.virus.scanning.warn.message": "true",
- "js.debugger.nextJs.config.created.client": "true",
- "js.debugger.nextJs.config.created.server": "true",
- "junie.onboarding.icon.badge.shown": "true",
- "list.type.of.created.stylesheet": "SCSS",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "npm.Next.js: server-side.executor": "Run",
- "prettierjs.PrettierConfiguration.Package": "C:\\dev-personal\\ocenka-web\\node_modules\\prettier",
- "settings.editor.selected.configurable": "terminal",
- "to.speed.mode.migration.done": "true",
- "ts.external.directory.path": "C:\\dev-personal\\ocenka-web\\node_modules\\typescript\\lib",
- "vue.rearranger.settings.migration": "true"
+
+}]]>
@@ -112,7 +99,7 @@
-
+
@@ -132,7 +119,8 @@
-
+
+
diff --git a/Dockerfile b/Dockerfile
index d9242e6..7685290 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,6 +13,19 @@ RUN npm install --frozen-lockfile
# ΠΠΎΠΏΠΈΡΡΠ΅ΠΌ Π²ΡΠ΅ ΡΠ°ΠΉΠ»Ρ ΠΏΡΠΎΠ΅ΠΊΡΠ°
COPY . .
+# ΠΡΠ³ΡΠΌΠ΅Π½Ρ ΡΠ±ΠΎΡΠΊΠΈ Π΄Π»Ρ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΠΎΠΉ ΠΎΠΊΡΡΠΆΠ΅Π½ΠΈΡ
+ARG NEXT_PUBLIC_MAIL_USER
+ARG NEXT_PUBLIC_MAIL_PASS
+ARG NEXT_PUBLIC_MAIL_FROM
+ARG NEXT_PUBLIC_MAIL_TO
+ARG NEXT_PUBLIC_MAIL_SECURE_KEY
+
+ENV NEXT_PUBLIC_MAIL_USER=$NEXT_PUBLIC_MAIL_USER \
+ NEXT_PUBLIC_MAIL_PASS=$NEXT_PUBLIC_MAIL_PASS \
+ NEXT_PUBLIC_MAIL_FROM=$NEXT_PUBLIC_MAIL_FROM \
+ NEXT_PUBLIC_MAIL_TO=$NEXT_PUBLIC_MAIL_TO \
+ NEXT_PUBLIC_MAIL_SECURE_KEY=$NEXT_PUBLIC_MAIL_SECURE_KEY
+
# Π‘ΠΎΠ±ΠΈΡΠ°Π΅ΠΌ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅
RUN npm run build
@@ -21,7 +34,12 @@ FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production \
- NEXT_TELEMETRY_DISABLED=1
+ NEXT_TELEMETRY_DISABLED=1 \
+ NEXT_PUBLIC_MAIL_USER=$NEXT_PUBLIC_MAIL_USER \
+ NEXT_PUBLIC_MAIL_PASS=$NEXT_PUBLIC_MAIL_PASS \
+ NEXT_PUBLIC_MAIL_FROM=$NEXT_PUBLIC_MAIL_FROM \
+ NEXT_PUBLIC_MAIL_TO=$NEXT_PUBLIC_MAIL_TO \
+ NEXT_PUBLIC_MAIL_SECURE_KEY=$NEXT_PUBLIC_MAIL_SECURE_KEY
# ΠΠΊΠ»ΡΡΠ°Π΅ΠΌ node ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ
RUN addgroup -g 1001 -S nodejs