Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

12 auto deploy to stage #1

Merged
merged 37 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ed03be3
Add Docker support
urumo Oct 14, 2024
6cf5dbe
Update GitHub Actions workflows for .NET project.
urumo Oct 14, 2024
eb8616c
Disable conditional run for the build job in CI.
urumo Oct 14, 2024
a87c315
[skip ci] Enable conditional job execution for the build workflow
urumo Oct 14, 2024
4771273
Comment out build condition and adjust Dockerfile path
urumo Oct 14, 2024
a9dd1c7
Refactor IMAGE_TAG environment variable setup
urumo Oct 14, 2024
4cee91f
Add ARM64 platform support to Docker build
urumo Oct 14, 2024
7662672
Update Dockerfile to use alpine3.18-arm64v8 images
urumo Oct 14, 2024
4dcd119
Fix Docker build platform in GitHub Action
urumo Oct 14, 2024
78cd587
Switch to bullseye-slim base images in Dockerfile
urumo Oct 14, 2024
dc762c8
Update Dockerfile to use alpine-based .NET images
urumo Oct 14, 2024
f909793
Update Dockerfile to use non-Alpine .NET images
urumo Oct 14, 2024
4eadf69
Use build platform variable in Dockerfile
urumo Oct 14, 2024
9b0711f
Switch to Alpine base images in Dockerfile
urumo Oct 14, 2024
86be8bc
Disable tagging and pushing as latest in Docker workflow
urumo Oct 14, 2024
403798c
Update Docker image tag in GitHub Actions workflow
urumo Oct 14, 2024
ec5335e
Update Docker build command to use buildx
urumo Oct 14, 2024
e516a08
Set Docker default platform to linux/arm64
urumo Oct 14, 2024
6e600c6
Add architecture support to Dockerfile
urumo Oct 14, 2024
efb5611
Switch to linux-arm64 runtime in Dockerfile
urumo Oct 14, 2024
28a9e03
Integrate QEMU and Buildx for multi-arch Docker builds
urumo Oct 14, 2024
e034623
Add Docker layer caching to CI workflow
urumo Oct 14, 2024
ee06fec
Change build platform to arm64 and remove redundant platform specifiers
urumo Oct 14, 2024
b8d5325
Simplify Docker build command
urumo Oct 14, 2024
6a4a384
Update Docker image build and push process
urumo Oct 14, 2024
ef3eca0
Update Docker image tags
urumo Oct 14, 2024
38d11fa
Update Docker image tag to use GitHub run number
urumo Oct 14, 2024
8c53d4a
Switch from Alpine to non-Alpine .NET images
urumo Oct 14, 2024
8687e24
Enable multi-platform builds in Dockerfile
urumo Oct 14, 2024
db35f2f
Update Docker tag to staging registry
urumo Oct 14, 2024
a834393
Switch to Alpine-based images for ARM64 support
urumo Oct 14, 2024
4c3c327
Rename job to 'qa' and update Dockerfile base images
urumo Oct 14, 2024
7f65795
Add checkout step to API workflow
urumo Oct 14, 2024
c39fef1
Disable build step conditional in GitHub Actions workflow
urumo Oct 14, 2024
d15adf6
Update configurations and add build time endpoint
urumo Oct 14, 2024
7e4596c
Remove QEMU and Docker caching setup steps
urumo Oct 14, 2024
7886ca6
Refactor root endpoint to return an anonymous object.
urumo Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
41 changes: 41 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: .NET

on:
push:
branches: [ "master" ]
paths:
- 'src/Argon.Api/**'
pull_request:
branches: [ "master" ]
paths:
- 'src/Argon.Api/**'

jobs:
qa:
runs-on: ARM64
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
build:
# if: github.ref == 'refs/heads/master'
runs-on: ARM64
needs: qa
steps:
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.REGISTRY }}
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PWD }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./src/Argon.Api/Dockerfile
push: true
tags: reg.staging.svck.dev/argon/api-orleans:${{ github.run_number }}
# platforms: linux/arm64/v8

28 changes: 0 additions & 28 deletions .github/workflows/dotnet.yml

This file was deleted.

7 changes: 7 additions & 0 deletions src/Argon.Api/Argon.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
Expand All @@ -23,4 +24,10 @@
<ProjectReference Include="..\ServiceDefaults\ServiceDefaults.csproj"/>
</ItemGroup>

<ItemGroup>
<Content Include="..\..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>

</Project>
24 changes: 24 additions & 0 deletions src/Argon.Api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine-arm64v8 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

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

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

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Argon.Api.dll"]
7 changes: 4 additions & 3 deletions src/Argon.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ public static async Task Main(string[] args)
siloBuilder.AddMemoryGrainStorage("replaceme"); // TODO: replace me pls
});
var app = builder.Build();
app.UseSwagger();
app.UseSwaggerUI();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
using var scope = app.Services.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
Thread.Sleep(5000);
await db.Database.MigrateAsync();
}

app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.MapDefaultEndpoints();
var buildTime = File.GetLastWriteTimeUtc(typeof(Program).Assembly.Location);
app.MapGet("/", () => new { buildTime = buildTime });
await app.RunAsync();
}
}
2 changes: 1 addition & 1 deletion src/Argon.Api/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=database;Port=5432;Username=svck;Password=Password123;Database=apiDb",
"DefaultConnection": "Host=localhost;Port=5432;Username=svck;Password=1ed1f86a265ecffa4c0de1a1;Database=argon_api",
"cache": "localhost:1500",
"rmq": "amqp://svck:Password123@localhost:5672"
},
Expand Down
Loading