mirror of
https://github.com/morbalint/kemkas.git
synced 2026-07-18 03:13:46 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ffa0c24fd7 | |||
| ebe70f9446 | |||
| 26857ef8d5 | |||
| d1e0a41676 | |||
| 460ea27a48 | |||
| 22270f4bf7 | |||
| 0f24f19c71 |
@@ -9,12 +9,10 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
ci-fe:
|
ci-fe:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js 18.x
|
- name: Setup Node.js 18.x
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version: 18.x
|
||||||
- name: Cache NPM packages
|
- name: Cache NPM packages
|
||||||
@@ -68,6 +66,93 @@ jobs:
|
|||||||
docker push registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8}
|
docker push registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8}
|
||||||
docker push ghcr.io/${{ github.repository_owner }}/kemkas:${GITHUB_SHA::8}
|
docker push ghcr.io/${{ github.repository_owner }}/kemkas:${GITHUB_SHA::8}
|
||||||
|
|
||||||
|
docker-fe-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Install doctl
|
||||||
|
uses: digitalocean/action-doctl@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.DO_ACCESS_TOKEN }}
|
||||||
|
- name: Log in to DigitalOcean Container Registry with short-lived credentials
|
||||||
|
run: doctl registry login --expiry-seconds 1200
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||||
|
- uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./Kemkas.Web/frontend/
|
||||||
|
file: ./Kemkas.Web/frontend/Dockerfile
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
push: false
|
||||||
|
load: true
|
||||||
|
tags: kemkas/kemkas-fe:edge
|
||||||
|
- name: Tag container image
|
||||||
|
run: |
|
||||||
|
docker tag kemkas/kemkas-fe:edge registry.digitalocean.com/kemkas/kemkas-fe:${GITHUB_SHA::8}
|
||||||
|
docker tag kemkas/kemkas-fe:edge ghcr.io/${{ github.repository_owner }}/kemkas-fe:${GITHUB_SHA::8}
|
||||||
|
- name: Push image to Container Registry
|
||||||
|
run: |
|
||||||
|
docker push registry.digitalocean.com/kemkas/kemkas-fe:${GITHUB_SHA::8}
|
||||||
|
docker push ghcr.io/${{ github.repository_owner }}/kemkas-fe:${GITHUB_SHA::8}
|
||||||
|
|
||||||
|
docker-be-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Install doctl
|
||||||
|
uses: digitalocean/action-doctl@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.DO_ACCESS_TOKEN }}
|
||||||
|
- name: Log in to DigitalOcean Container Registry with short-lived credentials
|
||||||
|
run: doctl registry login --expiry-seconds 1200
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||||
|
- uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Kemkas.Web/Backend.Dockerfile
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
push: false
|
||||||
|
load: true
|
||||||
|
tags: kemkas/kemkas-be:edge
|
||||||
|
- name: Tag container image
|
||||||
|
run: |
|
||||||
|
docker tag kemkas/kemkas-be:edge registry.digitalocean.com/kemkas/kemkas-be:${GITHUB_SHA::8}
|
||||||
|
docker tag kemkas/kemkas-be:edge ghcr.io/${{ github.repository_owner }}/kemkas-be:${GITHUB_SHA::8}
|
||||||
|
- name: Push image to Container Registry
|
||||||
|
run: |
|
||||||
|
docker push registry.digitalocean.com/kemkas/kemkas-be:${GITHUB_SHA::8}
|
||||||
|
docker push ghcr.io/${{ github.repository_owner }}/kemkas-be:${GITHUB_SHA::8}
|
||||||
|
|
||||||
|
docker-composit-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs:
|
||||||
|
- docker-be-build
|
||||||
|
- docker-fe-build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||||
|
- uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Kemkas.Web/Composite.Dockerfile
|
||||||
|
args: FE_TAG=${GITHUB_SHA::8},BE_TAG=${GITHUB_SHA::8}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
push: false
|
||||||
|
load: true
|
||||||
|
tags: ghcr.io/${{ github.repository_owner }}/kemkas/kemkas-composite:${GITHUB_SHA::8}
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
@@ -100,8 +185,13 @@ jobs:
|
|||||||
export DOCKER_IMAGE_ID=$(docker images ghcr.io/${{ github.repository_owner }}/kemkas:${GITHUB_SHA::8} --format "{{.ID}}")
|
export DOCKER_IMAGE_ID=$(docker images ghcr.io/${{ github.repository_owner }}/kemkas:${GITHUB_SHA::8} --format "{{.ID}}")
|
||||||
export DOCKER_IMAGE_ID=GHCR-$DOCKER_IMAGE_ID
|
export DOCKER_IMAGE_ID=GHCR-$DOCKER_IMAGE_ID
|
||||||
echo "DOCKER_IMAGE_ID=$DOCKER_IMAGE_ID" >> $GITHUB_ENV
|
echo "DOCKER_IMAGE_ID=$DOCKER_IMAGE_ID" >> $GITHUB_ENV
|
||||||
- name: Tag commit
|
- name: Tag commit with docker image ID
|
||||||
uses: tvdias/github-tagger@v0.0.1
|
uses: actions/github-script@v5
|
||||||
with:
|
with:
|
||||||
repo-token: "${{ github.token }}"
|
script: |
|
||||||
tag: "${{ env.DOCKER_IMAGE_ID }}"
|
github.rest.git.createRef({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
ref: "refs/tags/${{ env.DOCKER_IMAGE_ID }}",
|
||||||
|
sha: context.sha
|
||||||
|
})
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ["Kemkas.Web/Kemkas.Web.csproj", "Kemkas.Web/"]
|
||||||
|
RUN dotnet restore "Kemkas.Web/Kemkas.Web.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/Kemkas.Web"
|
||||||
|
RUN dotnet build "Kemkas.Web.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
RUN dotnet publish "Kemkas.Web.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "Kemkas.Web.dll"]
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
|
||||||
|
ARG FE_TAG=latest
|
||||||
|
ARG BE_TAG=latest
|
||||||
|
|
||||||
|
FROM ghcr.io/morbalint/kemkas-fe:${FE_TAG} as frontend
|
||||||
|
FROM ghcr.io/morbalint/kemkas-be:${BE_TAG} as backend
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
COPY --from=backend /app .
|
||||||
|
COPY --from=frontend /usr/share/nginx/html ./wwwroot
|
||||||
|
ENTRYPOINT ["dotnet", "Kemkas.Web.dll"]
|
||||||
@@ -13,5 +13,5 @@ RUN yarn build
|
|||||||
|
|
||||||
FROM nginx:latest as proxy
|
FROM nginx:latest as proxy
|
||||||
|
|
||||||
# COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
COPY --from=builder "/src/build" "/usr/share/nginx/html"
|
||||||
COPY --from=builder "/src/build" "/usr/share/nginx/html"
|
COPY ./nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log notice;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,11 +40,11 @@ function DrawFelszereles(draw: (text: string, x: number, y:number) => void, fels
|
|||||||
|
|
||||||
export async function CreatePDF(karakter: KarakterPdfView) {
|
export async function CreatePDF(karakter: KarakterPdfView) {
|
||||||
|
|
||||||
const existingPdfBytes = await fetch('/km_karakterlap_hysteria_1.2.pdf').then(res => res.arrayBuffer())
|
const existingPdfBytes = await fetch('/pdfs/km_karakterlap_hysteria_1.2.pdf').then(res => res.arrayBuffer())
|
||||||
const pdfDoc = await PDFDocument.load(existingPdfBytes)
|
const pdfDoc = await PDFDocument.load(existingPdfBytes)
|
||||||
pdfDoc.registerFontkit(fontkit)
|
pdfDoc.registerFontkit(fontkit)
|
||||||
|
|
||||||
const fontBytes = await fetch('/Merienda-Regular.ttf').then(res => res.arrayBuffer())
|
const fontBytes = await fetch('/fonts/Merienda-Regular.ttf').then(res => res.arrayBuffer())
|
||||||
const pdfFont = await pdfDoc.embedFont(fontBytes)
|
const pdfFont = await pdfDoc.embedFont(fontBytes)
|
||||||
const fontSizeBase = 12
|
const fontSizeBase = 12
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ export async function CreatePDF(karakter: KarakterPdfView) {
|
|||||||
DrawMagic(page, fontSizeBase, pdfFont, karakter.NapiMemorizalhatoVarazslatok, karakter.VarazslatMentokNF)
|
DrawMagic(page, fontSizeBase, pdfFont, karakter.NapiMemorizalhatoVarazslatok, karakter.VarazslatMentokNF)
|
||||||
|
|
||||||
const secondPage = pdfDoc.addPage()
|
const secondPage = pdfDoc.addPage()
|
||||||
const fontBoldBytes = await fetch('/Merienda-Bold.ttf').then(res => res.arrayBuffer())
|
const fontBoldBytes = await fetch('/fonts/Merienda-Bold.ttf').then(res => res.arrayBuffer())
|
||||||
const fontBold = await pdfDoc.embedFont(fontBoldBytes)
|
const fontBold = await pdfDoc.embedFont(fontBoldBytes)
|
||||||
DrawOsztalySpecialsPage(secondPage, pdfFont, fontBold, karakter)
|
DrawOsztalySpecialsPage(secondPage, pdfFont, fontBold, karakter)
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import download from "downloadjs";
|
|||||||
import {SignedNumberToText} from "../../shared/components/Helpers";
|
import {SignedNumberToText} from "../../shared/components/Helpers";
|
||||||
|
|
||||||
export async function CreatePDF(karakter: KarakterPdfView) {
|
export async function CreatePDF(karakter: KarakterPdfView) {
|
||||||
const existingPdfBytes = await fetch('/kem2karakterlap_form.pdf').then(res => res.arrayBuffer())
|
const existingPdfBytes = await fetch('/pdfs/kem2karakterlap_form.pdf').then(res => res.arrayBuffer())
|
||||||
const pdfDoc = await PDFDocument.load(existingPdfBytes)
|
const pdfDoc = await PDFDocument.load(existingPdfBytes)
|
||||||
pdfDoc.registerFontkit(fontkit)
|
pdfDoc.registerFontkit(fontkit)
|
||||||
|
|
||||||
const fontBytes = await fetch('/Milonga-Regular.ttf').then(res => res.arrayBuffer())
|
const fontBytes = await fetch('/fonts/Milonga-Regular.ttf').then(res => res.arrayBuffer())
|
||||||
const pdfFont = await pdfDoc.embedFont(fontBytes)
|
const pdfFont = await pdfDoc.embedFont(fontBytes)
|
||||||
|
|
||||||
const form = pdfDoc.getForm()
|
const form = pdfDoc.getForm()
|
||||||
|
|||||||
Reference in New Issue
Block a user