2 Commits

Author SHA1 Message Date
5a309e45fe preliminary ci/cd setup (horrors await me) 2026-02-28 14:52:59 -06:00
24b9f21541 deploy setup 2026-02-27 21:34:13 -06:00
7 changed files with 141 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
name: Build and Deploy API
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: docker
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Validate Registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.bxvard.net -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin
- name: Build Docker image
run: |
docker build -t git.bxvard.net/homeburger/agologum-api:latest ./api
- name: Push image
run: |
docker push git.vxbard.net/homeburger/agologum-api:latest
- name: Deploy container
run: |
docker compose -f docker-compose.prod.yaml pull agologum-api
docker compose -f docker-compose.prod.yaml up -d agologum-api

View File

@@ -0,0 +1,33 @@
name: Build and Deploy Frontend
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: docker
steps:
- uses: actions/checkout@v3
- name: Login to Registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login yourdomain.com \
-u ${{ secrets.REGISTRY_USERNAME }} \
--password-stdin
- name: Build image
run: |
docker build -t yourdomain.com/owner/frontend:latest .
- name: Push
run: |
docker push yourdomain.com/owner/frontend:latest
- name: Deploy
run: |
docker compose -f /path/to/docker-compose.yml pull frontend
docker compose -f /path/to/docker-compose.yml up -d frontend

20
api/Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
# build
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY *.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /app/publish
# run
FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:8080
COPY --from=build /app/publish .
EXPOSE 8080
ENTRYPOINT ["dotnet", "agologum-api.dll"]

View File

@@ -19,7 +19,7 @@ var summaries = new[]
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
app.MapGet("/weatherforecast", () =>
app.MapGet("api/weatherforecast", () =>
{
var forecast = Enumerable.Range(1, 5).Select(index =>
new WeatherForecast

20
client/Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
# build vue app
FROM node:current-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# serve to nginx
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

12
client/nginx.conf Normal file
View File

@@ -0,0 +1,12 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}

23
docker-compose.prod.yaml Normal file
View File

@@ -0,0 +1,23 @@
services:
api:
image: git.vxbard.net/homeburger/agologum-api:latest
container_name: agologum-api
restart: always
ports:
- "5000:80"
networks:
- web
client:
image: git.vxbard.net/homeburger/agologum-client:latest
container_name: agologum-client
restart: always
ports:
- "8080:80"
networks:
- web
networks:
web:
external: true