Skip to content

Commit

Permalink
Merge pull request #18 from SnowSE/master
Browse files Browse the repository at this point in the history
Move beta.sanpetepantry.org (as in master) into Prod.
  • Loading branch information
HeberAtSnow authored Jul 2, 2024
2 parents baf4440 + 78423ad commit 3983582
Show file tree
Hide file tree
Showing 80 changed files with 2,298 additions and 481 deletions.
Binary file added .DS_Store
Binary file not shown.
77 changes: 19 additions & 58 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,29 @@
name: Deploy to Beta
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Deploy.NET

on:
push:
branches: [ beta ]
branches: [ "beta" ]
pull_request:
branches: [ beta ]
branches: [ "beta" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
ref: beta

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
runs-on: self-hosted
env:
DOTNET_INSTALL_DIR: "/home/github/actions-runner/dotnet"

- name: Get smart tag
id: prepare
uses: Surgo/docker-smart-tag-action@v1
with:
docker_image: sanpetepantry/web
tag_with_sha: true

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
file: SanpetePantry/Dockerfile
push: true
tags: ${{ steps.prepare.outputs.tag }}
build-args: |
exampleArg=exampleArgValue
otherArg=$GITHUB_SHA
- name: Image Digest
run: echo ${{ steps.docker_build.outputs.digest }}

- name: SFTP uploader
uses: wangyucode/[email protected]
with:
host: ${{ secrets.LINODE_SERVER }}
username: ${{ secrets.LINODE_USER }}
password: ${{ secrets.LINODE_PASSWORD }}
localDir: scripts
remoteDir: scripts

- name: Start the service
uses: garygrossgarten/[email protected]
with:
command: cd scripts && pwsh ./restart.ps1 -tag ${{ steps.prepare.outputs.tag}} -branch beta
host: ${{ secrets.LINODE_SERVER }}
username: ${{ secrets.LINODE_USER }}
password: ${{ secrets.LINODE_PASSWORD }}
defaults:
run:
working-directory: .

steps:
- uses: actions/checkout@v3
- name: Run
run: |
cd scripts
docker-compose -f docker-compose-beta.yml up --build -d
docker images prune --quiet
21 changes: 20 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Sanpete Pantry

## Table of Contents

---

1. <a href="#introduction">Introduction</a>
2. <a href="#config">Config & Setup</a>

---

<div id="introduction"></div>

## Introduction

<img width="200" alt="logo" src="./SanpetePantry/wwwroot/img/Logo.webp" />

Sanpete Pantry is the Food Pantry for Sanpete County and is dedicated to eliminating hunger in Sanpete County. This is the repository for our public website: [Visit here](https://SanpetePantry.org)

<div id="config"></div>

## Config & Setup Notes
- Logged in as root:
- `apt install docker.io`
Expand All @@ -19,4 +38,4 @@
- `mkdir /home/pantry/scripts`
- Now you're ready to have the GitHub action deploy to the server.

[Workflow File](.github/workflows/main.yml)
[Workflow File](.github/workflows/main.yml)
3 changes: 2 additions & 1 deletion SanpetePantry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-co
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{75C99FEF-AA1D-4BD9-9D70-3C9C6CD6B218}"
ProjectSection(SolutionItems) = preProject
scripts\docker-compose.yml = scripts\docker-compose.yml
scripts\docker-compose-beta.yml = scripts\docker-compose-beta.yml
scripts\docker-compose-prod.yml = scripts\docker-compose-prod.yml
scripts\restart.ps1 = scripts\restart.ps1
EndProjectSection
EndProject
Expand Down
Binary file added SanpetePantry/.DS_Store
Binary file not shown.
34 changes: 20 additions & 14 deletions SanpetePantry/App.razor
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<CascadingAuthenticationState>
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
</CascadingAuthenticationState>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="css/site.css" />
<link rel="stylesheet" href="SanpetePantry.styles.css" />
<link rel="icon" type="image/png" href="favicon.png" />
<HeadOutlet />
</head>

<body>
<Routes />
<script src="_framework/blazor.web.js"></script>
</body>

</html>
19 changes: 11 additions & 8 deletions SanpetePantry/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 80
EXPOSE 443
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["SanpetePantry/SanpetePantry.csproj", "SanpetePantry/"]
RUN dotnet restore "SanpetePantry/SanpetePantry.csproj"
RUN dotnet restore "./SanpetePantry/./SanpetePantry.csproj"
COPY . .
WORKDIR "/src/SanpetePantry"
RUN dotnet build "SanpetePantry.csproj" -c Release -o /app/build
RUN dotnet build "./SanpetePantry.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
RUN dotnet publish "SanpetePantry.csproj" -c Release -o /app/publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./SanpetePantry.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
Expand Down
110 changes: 110 additions & 0 deletions SanpetePantry/Pages/2023GalaSponsors.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
@page "/2023GalaSponsors"
@rendermode InteractiveServer

<h1>2023 Gala Sponsors</h1>

<div id="gala-ctn">
</div>

<script>
async function loadSponsors() {
const galaContainer = document.querySelector("#gala-ctn");
try {
const response = await fetch("/sponsorships.json");
const allSponsors = await response.json();
const galaSponsors = allSponsors["2023 Gala"];
galaSponsors.forEach(sponsor => {
console.log(sponsor);
const sponsorDiv = document.createElement('div');
sponsorDiv.className = "sponsor-div";
const titleDiv = document.createElement('div');
titleDiv.innerText = sponsor.name;
titleDiv.className = "title-div";
const imgDiv = document.createElement('div');
imgDiv.className = "img-div";
const externalLink = document.createElement('a');
externalLink.href = sponsor["page-link"];
const img = document.createElement('img');
img.src = sponsor["image-link"];
img.className = "sponsor-img";
externalLink.appendChild(img);
imgDiv.appendChild(externalLink);
sponsorDiv.appendChild(imgDiv);
sponsorDiv.appendChild(titleDiv);
galaContainer.appendChild(sponsorDiv);
});
} catch (error) {
console.log("Error at 2023 Gala Sponsors", error);
}
}
loadSponsors();
</script>

<style>
#gala-ctn {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 1em;
}
.sponsor-div {
border: 0.2em solid black;
flex-basis: 30%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
border-radius: 2em 2em 2em 2em;
background-color: #BEA6A1;
transition: 0.5s;
}
.sponsor-div:hover {
flex-basis: 35%;
}
.sponsor-img {
max-width: 20em;
max-height: 12em;
min-width: 10em;
min-height: 5em;
}
.title-div {
font-size: x-large;
font-weight: 300;
padding: 0.5em;
color: black;
}
.img-div {
padding: 1.5em;
}
h1 {
margin: 1em;
}
</style>
Loading

0 comments on commit 3983582

Please sign in to comment.