feat: Add Docker configuration and update deployment workflow

This commit is contained in:
masoodafar-web
2025-12-06 21:54:09 +03:30
parent f5b8052245
commit 9146391928
6 changed files with 99 additions and 16 deletions

View File

@@ -15,27 +15,38 @@ jobs:
container: container:
image: docker:latest image: docker:latest
options: --privileged options: --privileged
env:
HTTP_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128
HTTPS_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128
NO_PROXY: localhost,127.0.0.1,gitea-svc,194.5.195.53,10.0.0.0/8
steps: steps:
- name: Install git - name: Install git
run: | run: apk add --no-cache git
export http_proxy=http://proxyuser:87zH26nbqT2@46.249.98.211:3128
export https_proxy=http://proxyuser:87zH26nbqT2@46.249.98.211:3128
apk add --no-cache git
- name: Checkout code - name: Clone repo
run: | run: |
git clone --depth 1 --branch kub-stage http://gitea-svc:3000/admin/BackOffice.git . git clone --depth 1 --branch kub-stage http://gitea-svc:3000/admin/BackOffice.git .
git log -1 --format="%H %s"
- name: Start Docker daemon with insecure registry - name: Start Docker daemon with insecure registry
run: | run: |
mkdir -p /etc/docker mkdir -p /etc/docker
cat > /etc/docker/daemon.json << 'DOCKER_EOF' cat > /etc/docker/daemon.json << 'DAEMON'
{ {
"insecure-registries": ["gitea-svc:3000"] "insecure-registries": ["194.5.195.53:30080", "gitea-svc:3000"]
} }
DOCKER_EOF DAEMON
mkdir -p ~/.docker
cat > ~/.docker/config.json << 'CONF'
{
"proxies": {
"default": {
"httpProxy": "http://proxyuser:87zH26nbqT2@46.249.98.211:3128",
"httpsProxy": "http://proxyuser:87zH26nbqT2@46.249.98.211:3128",
"noProxy": "localhost,127.0.0.1,gitea-svc,194.5.195.53,10.0.0.0/8"
}
}
}
CONF
dockerd & dockerd &
for i in $(seq 1 30); do for i in $(seq 1 30); do
docker info >/dev/null 2>&1 && break || sleep 2 docker info >/dev/null 2>&1 && break || sleep 2
@@ -44,8 +55,9 @@ jobs:
- name: Build Docker Image - name: Build Docker Image
run: | run: |
cd src/BackOffice cd src
docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \ docker build -f BackOffice/Dockerfile
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
--build-arg HTTP_PROXY=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 \ --build-arg HTTP_PROXY=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 \
--build-arg HTTPS_PROXY=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 \ --build-arg HTTPS_PROXY=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 \

25
src/.dockerignore Normal file
View File

@@ -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

View File

@@ -8,11 +8,15 @@
<BlazorCacheBootResources>false</BlazorCacheBootResources> <BlazorCacheBootResources>false</BlazorCacheBootResources>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute> <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="Common\NewFolder\**" /> <Compile Remove="Common\NewFolder\**" />
<Content Remove="Common\NewFolder\**" /> <Content Remove="Common\NewFolder\**" />
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
<EmbeddedResource Remove="Common\NewFolder\**" /> <EmbeddedResource Remove="Common\NewFolder\**" />
<None Remove="Common\NewFolder\**" /> <None Remove="Common\NewFolder\**" />

24
src/BackOffice/Dockerfile Normal file
View File

@@ -0,0 +1,24 @@
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["BackOffice/NuGet.config", "NuGet.config"]
COPY ["BackOffice/BackOffice.csproj", "BackOffice/"]
RUN dotnet restore "BackOffice/BackOffice.csproj" --configfile NuGet.config
COPY . .
WORKDIR "/src/BackOffice"
RUN dotnet build "./BackOffice.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./BackOffice.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "BackOffice.dll"]

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="FourSat" value="https://git.afrino.co/api/packages/FourSat/nuget/index.json" />
<add key="Afrino" value="https://git.afrino.co/api/packages/Afrino/nuget/index.json" />
</packageSources>
<packageSourceCredentials>
<FourSat>
<add key="Username" value="masoud" />
<add key="ClearTextPassword" value="87zH26nbqT" />
</FourSat>
<Afrino>
<add key="Username" value="systemuser" />
<add key="ClearTextPassword" value="sZSA7PTiv3pUSQZ" />
</Afrino>
</packageSourceCredentials>
</configuration>

View File

@@ -1,6 +1,6 @@
{ {
// "GwUrl": "https://bogw.kbs1.ir", // "GwUrl": "https://bogw.kbs1.ir",
"GwUrl": "https://localhost:6468", "GwUrl": "http://backoffice-bff-svc",
"Authentication": { "Authentication": {
//"Authority": "https://localhost:5001", //"Authority": "https://localhost:5001",
"Authority": "https://ids.afrino.co/", "Authority": "https://ids.afrino.co/",