Compare commits

..

35 Commits

Author SHA1 Message Date
45171382f0 Merge pull request 'ENabled priviledged mode on docker push step' (#36) from test into main
Some checks failed
continuous-integration/drone Build encountered an error
Reviewed-on: #36
2026-03-08 11:43:19 +02:00
eb4884eab5 Merge pull request 'Using manual docker push' (#35) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #35
2026-03-08 11:39:46 +02:00
2b3bd2897c Merge pull request 'test' (#34) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #34
2026-03-08 11:34:50 +02:00
1831c79554 Merge pull request 'Removed debug flag from docker push, removed drone build number tag' (#33) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #33
2026-03-08 11:22:24 +02:00
909b9e742a Merge pull request 'Using raw username' (#32) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #32
2026-03-08 11:15:49 +02:00
bec8ce3e74 Merge pull request 'Added debug flag' (#31) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #31
2026-03-08 11:05:36 +02:00
6ee84199b2 Merge pull request 'Added tagging' (#30) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #30
2026-03-08 10:57:34 +02:00
895bce48d2 Merge pull request 'Disabled broken automatic clone, added manual clone' (#29) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #29
2026-03-08 10:49:44 +02:00
087358efc6 Merge pull request 'Light refactor' (#28) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/28
2026-03-08 08:52:45 +02:00
d828595384 Merge pull request 'test' (#27) from test into main
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/27
2026-03-08 08:41:23 +02:00
8cff952b17 Merge pull request 'Reverted to registry proxy' (#26) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/26
2026-03-07 17:59:15 +02:00
1af6ceb288 Merge pull request 'talking to registry directly' (#25) from test into main
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/25
2026-03-07 17:58:42 +02:00
d801f96fb9 Merge pull request 'Not ignoring bin folder' (#24) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/24
2026-03-07 17:13:36 +02:00
1cc3750fa3 Merge pull request 'Allowing .net 8 publish files' (#23) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/23
2026-03-07 17:09:14 +02:00
e38dff6e92 Merge pull request 'Added dockerignore rule to allow all publish folders' (#22) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/22
2026-03-07 17:06:06 +02:00
c4b125a580 Merge pull request 'Rfactored dockerfile to reuse pipeline publish output' (#21) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/21
2026-03-07 17:01:37 +02:00
c9de909eb6 Merge pull request 'Refactored the source context in the package step' (#20) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/20
2026-03-07 16:55:39 +02:00
7eb870a29c Merge pull request 'Removed credentials from package operation' (#19) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/19
2026-03-07 16:50:21 +02:00
83c7844880 Merge pull request 'test' (#18) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/18
2026-03-07 16:44:12 +02:00
69b92e9323 Merge pull request 'Changed to gitea-token' (#17) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/17
2026-03-07 11:35:25 +02:00
fcfd265c46 Merge pull request 'Flattened pipeline stages' (#16) from test into main
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/16
2026-03-07 11:23:56 +02:00
bc3a44d5ea Merge pull request 'Changed pipeline type from kubernetes to docker' (#15) from test into main
Some checks failed
continuous-integration/drone Build encountered an error
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/15
2026-03-07 11:19:11 +02:00
cded235985 Merge pull request 'test' (#14) from test into main
Some checks failed
continuous-integration/drone Build encountered an error
Reviewed-on: $scheme://$host/MngomaLab/webapitest/pulls/14
2026-03-07 11:14:59 +02:00
f15143349e Merge pull request 'Refactored docker-compose.yml to expose ports and specify environment' (#13) from test into main
Some checks failed
continuous-integration/drone Build was killed
Reviewed-on: #13
2026-03-03 17:46:35 +02:00
7d8f15104c Merge pull request 'Refactored dockerfile stage 2 ports exposure' (#12) from test into main
Reviewed-on: #12
2026-03-03 17:43:34 +02:00
e2b5f2db8c Merge pull request 'Exposed ports on dockerfile' (#11) from test into main
Reviewed-on: #11
2026-03-03 17:41:06 +02:00
57ba629d2d Merge pull request 'Refactored dockerfile' (#10) from test into main
Reviewed-on: #10
2026-03-03 17:34:50 +02:00
d30ee959ee Merge pull request 'Refactored docker file' (#9) from test into main
Reviewed-on: #9
2026-03-03 17:27:19 +02:00
4e653fd91d Merge pull request 'Refactored docker file' (#8) from test into main
Reviewed-on: #8
2026-03-03 15:06:12 +02:00
b4ee875ac8 Merge pull request 'Added debug lines' (#7) from test into main
Reviewed-on: #7
2026-03-03 14:57:27 +02:00
7d395e2295 Merge pull request 'Refactored paths' (#6) from test into main
Reviewed-on: #6
2026-03-03 14:56:07 +02:00
ddc66efc16 Merge pull request 'test' (#5) from test into main
Reviewed-on: #5
2026-03-03 14:54:08 +02:00
82348a0112 Merge pull request 'Refactored dockerfile' (#4) from test into main
Reviewed-on: #4
2026-03-03 14:50:40 +02:00
e495be1c0b Merge pull request 'Fixed docker image typo' (#3) from test into main
Reviewed-on: #3
2026-03-03 14:44:38 +02:00
5a530210c0 Merge pull request 'Refactored docker file image to SDK' (#2) from test into main
Reviewed-on: #2
2026-03-03 13:38:04 +02:00
6 changed files with 47 additions and 116 deletions

View File

@@ -27,6 +27,4 @@ README.md
!.git/config !.git/config
!.git/packed-refs !.git/packed-refs
!.git/refs/heads/** !.git/refs/heads/**
# Ensure the build output is NOT ignored
!**/bin/Release/**/publish/
!**/publish/

View File

@@ -1,68 +1,44 @@
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: build-and-package name: package
clone:
disable: true
steps: steps:
- name: build-test-publish - name: clone
image: nexus.khongisa.co.za/sdk:10.0 image: alpine/git
commands: commands:
- dotnet restore --source https://nexus.khongisa.co.za/repository/nuget-group/index.json --no-cache - git clone https://gitea.khongisa.co.za/MngomaLab/webapitest.git .
- dotnet build --configuration Release --no-restore - git checkout ${DRONE_COMMIT}
- dotnet test --configuration Release --no-build
- dotnet publish --configuration Release --no-build
- name: docker-build-and-push - name: dotnet publish
image: plugins/docker image: mcr.microsoft.com/dotnet/sdk:8.0
settings:
registry: nexus.khongisa.co.za
repo: nexus.khongisa.co.za/webapitest
tags: [ "${DRONE_BUILD_NUMBER}", "latest" ]
username: { from_secret: docker_username }
password: { from_secret: docker_password }
- name: vulnerability-scan
image: aquasec/trivy:0.50.1
environment:
TRIVY_USERNAME: { from_secret: docker_username }
TRIVY_PASSWORD: { from_secret: docker_password }
commands: commands:
- trivy image --image-src remote --exit-code 1 --severity CRITICAL nexus.khongisa.co.za/webapitest:${DRONE_BUILD_NUMBER} - dotnet publish --configuration Release
- ls ./SampleApi/bin/Release/net8.0/publish/
trigger: - name: docker login
branch: image: docker:20.10
- main
event:
exclude:
- promote
---
kind: pipeline
type: docker
name: deploy-to-uat
depends_on:
- build-and-package
steps:
- name: uat-deployment
image: appleboy/drone-ssh
settings:
host: { from_secret: ssh_host }
username: { from_secret: ssh_user }
password: { from_secret: ssh_password }
script:
- echo $DOCKER_PASSWORD | docker login nexus.khongisa.co.za -u $DOCKER_USERNAME --password-stdin
- docker pull nexus.khongisa.co.za/webapitest:latest
- docker stop webapi 2>/dev/null || true
- docker rm webapi 2>/dev/null || true
- docker run -d --name webapi --restart unless-stopped -e ASPNETCORE_ENVIRONMENT=Development -p 4000:8081 nexus.khongisa.co.za/webapitest:latest
environment: environment:
DOCKER_USERNAME: { from_secret: docker_username } DOCKER_USERNAME:
DOCKER_PASSWORD: { from_secret: docker_password } from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
commands:
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
trigger: - name: docker build and push
event: image: docker:20.10
- promote privileged: true
target: environment:
- staging DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
commands:
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
- docker build -t khwezi/webapitest:latest -t khwezi/webapitest:${DRONE_BUILD_NUMBER} .
- docker push khwezi/webapitest:latest
- docker push khwezi/webapitest:${DRONE_BUILD_NUMBER}

View File

@@ -1,11 +1,9 @@
FROM nexus.khongisa.co.za/aspnet:10.0 AS final FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app WORKDIR /app
USER app COPY ./SampleApi/bin/Release/net8.0/publish/ .
COPY --chown=app:app ./SampleApi/bin/Release/net10.0/publish/ .
EXPOSE 8081
ENV ASPNETCORE_HTTP_PORTS=8081 ENV ASPNETCORE_HTTP_PORTS=8081
EXPOSE 8081
ENTRYPOINT ["dotnet", "SampleApi.dll"] ENTRYPOINT ["dotnet", "SampleApi.dll"]

View File

@@ -1,43 +0,0 @@
using Microsoft.AspNetCore.Mvc;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace SampleApi.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class DemoController : ControllerBase
{
// GET: api/<DemoController>
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/<DemoController>/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/<DemoController>
[HttpPost]
public void Post([FromBody] string value)
{
}
// PUT api/<DemoController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/<DemoController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}

View File

@@ -1,22 +1,25 @@
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers(); builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(); builder.Services.AddSwaggerGen();
builder.Services.AddHealthChecks();
var app = builder.Build(); var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) if (app.Environment.IsDevelopment())
{ {
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(); app.UseSwaggerUI();
} }
app.MapHealthChecks("/health");
app.UseRouting();
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseAuthorization(); app.UseAuthorization();
app.MapControllers(); app.MapControllers();
app.Run(); app.Run();

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>cfe6b4ce-2d40-4273-b3a3-e4df67304fc5</UserSecretsId> <UserSecretsId>cfe6b4ce-2d40-4273-b3a3-e4df67304fc5</UserSecretsId>
@@ -9,9 +9,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Polly" Version="8.6.6" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.7" />
</ItemGroup> </ItemGroup>
</Project> </Project>