Compare commits
No commits in common. "8c340e2a97ccbe8dfe1bc15b1223adcd82da31d5" and "42f0b8ee0e467516264e0dce7db412e4c51cdb4e" have entirely different histories.
8c340e2a97
...
42f0b8ee0e
@ -1,48 +0,0 @@
|
||||
name: Build and Deploy Docker Container
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
[master, 'release/*']
|
||||
|
||||
jobs:
|
||||
build_and_deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||
|
||||
- name: Build and push Docker image
|
||||
run: |
|
||||
docker build --build-arg NUGET_USERNAME=${{ secrets.NUGET_USERNAME }} --build-arg NUGET_PASSWORD=${{ secrets.NUGET_PASSWORD }} -t ${{ secrets.DOCKER_USERNAME }}/your-app-name:latest .
|
||||
docker push ${{ secrets.DOCKER_USERNAME }}/your-app-name:latest
|
||||
|
||||
- name: Start ssh-agent
|
||||
id: ssh-agent
|
||||
uses: webfactory/ssh-agent@v0.9.0
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
||||
- name: Deploy to Server
|
||||
env:
|
||||
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||
SSH_USER: ${{ secrets.SSH_USER }}
|
||||
DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/mirea-bakend:latest
|
||||
run: |
|
||||
ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts
|
||||
ssh $SSH_USER@$SSH_HOST "
|
||||
docker pull $DOCKER_IMAGE &&
|
||||
docker stop mirea-bakend || true &&
|
||||
docker rm mirea-bakend || true &&
|
||||
docker run -d --name mirea-bakend -p 8085:8080 $DOCKER_IMAGE
|
||||
"
|
||||
|
||||
- name: Remove all keys from ssh-agent
|
||||
run: ssh-add -D
|
@ -11,7 +11,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up .NET Core
|
||||
|
@ -12,7 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elements of the solution",
|
||||
.gitattributes = .gitattributes
|
||||
.gitignore = .gitignore
|
||||
Dockerfile = Dockerfile
|
||||
.gitea\workflows\deploy.yaml = .gitea\workflows\deploy.yaml
|
||||
LICENSE.txt = LICENSE.txt
|
||||
README.md = README.md
|
||||
.gitea\workflows\test.yaml = .gitea\workflows\test.yaml
|
||||
|
28
Dockerfile
28
Dockerfile
@ -1,23 +1,25 @@
|
||||
#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:8.0 AS base
|
||||
LABEL company="Winsomnia"
|
||||
LABEL maintainer.name="Wesser" maintainer.email="support@winsomnia.net"
|
||||
USER app
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
EXPOSE 8081
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["Backend.csproj", "."]
|
||||
RUN dotnet restore "./././Backend.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/."
|
||||
RUN dotnet build "./Backend.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
ARG NUGET_USERNAME
|
||||
ARG NUGET_PASSWORD
|
||||
ENV NUGET_USERNAME=$NUGET_USERNAME
|
||||
ENV NUGET_PASSWORD=$NUGET_PASSWORD
|
||||
|
||||
RUN dotnet restore ./Backend.sln --configfile nuget.config
|
||||
WORKDIR /app
|
||||
WORKDIR /src
|
||||
RUN dotnet publish ./Endpoint/Endpoint.csproj -c Release -o /app
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./Backend.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=build /app .
|
||||
ENTRYPOINT ["dotnet", "Enpoint.dll"]
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "Backend.dll"]
|
13
nuget.config
13
nuget.config
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="winsomnia.net" value="https://git.winsomnia.net/api/packages/Winsomnia/nuget/index.json" />
|
||||
</packageSources>
|
||||
<packageSourceCredentials>
|
||||
<winsomnia.net>
|
||||
<add key="Username" value="%NUGET_USERNAME%" />
|
||||
<add key="ClearTextPassword" value="%NUGET_PASSWORD%" />
|
||||
</winsomnia.net>
|
||||
</packageSourceCredentials>
|
||||
</configuration>
|
Loading…
Reference in New Issue
Block a user