Dockerfile update and removed unused scripts

master
Tudor Stanciu 2023-01-29 01:29:04 +02:00
parent f732578fb5
commit ff69e4964f
9 changed files with 6 additions and 209 deletions

View File

@ -59,16 +59,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution
ReleaseNotes.xml = ReleaseNotes.xml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{F92904AA-DC7A-4FD7-9807-3C5583C26D98}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "api", "api", "{1AE7B305-E24D-48A3-A732-91DAAACA39D6}"
ProjectSection(SolutionItems) = preProject
solution items\scripts\api\build-amd64.sh = solution items\scripts\api\build-amd64.sh
solution items\scripts\api\buildx-arm32.sh = solution items\scripts\api\buildx-arm32.sh
solution items\scripts\api\buildx.sh = solution items\scripts\api\buildx.sh
solution items\scripts\api\release.sh = solution items\scripts\api\release.sh
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "notes", "notes", "{A28CE618-9D99-491A-8DCF-23D4A19E7750}"
ProjectSection(SolutionItems) = preProject
solution items\notes\generic.txt = solution items\notes\generic.txt
@ -180,8 +170,6 @@ Global
{388D632D-8104-45E2-8017-D04848941F29} = {6889D39C-D8DA-4B99-AFC1-F0B6355E73C0}
{1EA9EAD7-8896-4756-A2C2-7969E9073FA6} = {43C78941-52E6-4AB8-9170-CC7C006E4784}
{3624DFF4-C692-42F8-BDC2-1C2107E6EDC8} = {C04663A1-E0CD-41D6-A8D7-FADDF9DA8302}
{F92904AA-DC7A-4FD7-9807-3C5583C26D98} = {C683E36F-A75F-4620-9D4F-2D73EE933AE1}
{1AE7B305-E24D-48A3-A732-91DAAACA39D6} = {F92904AA-DC7A-4FD7-9807-3C5583C26D98}
{A28CE618-9D99-491A-8DCF-23D4A19E7750} = {C683E36F-A75F-4620-9D4F-2D73EE933AE1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution

View File

@ -1,22 +0,0 @@
#!/bin/bash
echo "Welcome!"
version="1.0.5"
localRegistryPass="*********"
echo "Create docker image with version $version."
docker image build --build-arg APP_VERSION=$version -t "network-resurrector-api:$version" -f "src/api/NetworkResurrector.Api/Docker/amd64/Dockerfile" .
echo "Tag docker image with registry prefix."
docker tag network-resurrector-api:$version alpine-nexus:8500/network-resurrector/network-resurrector-api:$version
echo "Login to alpine-nexus registry."
docker login --username=admin --password=$localRegistryPass alpine-nexus:8500
echo "Push image alpine-nexus:8500/network-resurrector/network-resurrector-api:$version to registry."
docker push alpine-nexus:8500/network-resurrector/network-resurrector-api:$version
echo "Remove image alpine-nexus:8500/network-resurrector/network-resurrector-api:$version from local machine."
docker rmi alpine-nexus:8500/network-resurrector/network-resurrector-api:$version
echo "DONE!"

View File

@ -1,32 +0,0 @@
#!/bin/bash
echo "Welcome!"
version="1.0.1"
localRegistryPass="*********"
dockerHubRegistryPass="*********"
echo "Login to dockerhub registry."
docker login --username=tstanciu --password=$dockerHubRegistryPass
echo "Create docker image with version $version and publish it to dockerhub registry."
docker buildx build --build-arg APP_VERSION=$version --platform linux/arm/v7 -t "tstanciu/sta-registry:network-resurrector-api-$version-arm32v7" -f "src/api/NetworkResurrector.Api/Docker/arm32/Dockerfile" --push .
echo "Pull docker image with version $version from dockerhub registry."
docker pull tstanciu/sta-registry:network-resurrector-api-$version-arm32v7
echo "Tag docker image with alpine-nexus registry prefix."
docker tag tstanciu/sta-registry:network-resurrector-api-$version-arm32v7 alpine-nexus:8500/network-resurrector/network-resurrector-api:$version-arm32v7
echo "Login to alpine-nexus registry."
docker login --username=admin --password=$localRegistryPass alpine-nexus:8500
echo "Push image alpine-nexus:8500/network-resurrector/network-resurrector-api:$version-arm32v7 to registry."
docker push alpine-nexus:8500/network-resurrector/network-resurrector-api:$version-arm32v7
echo "Remove docker image tstanciu/sta-registry:network-resurrector-api-$version-arm32v7 from local machine."
docker rmi tstanciu/sta-registry:network-resurrector-api-$version-arm32v7
echo "Remove docker image tstanciu/sta-registry:network-resurrector-api-$version-arm32v7 from local machine."
docker rmi alpine-nexus:8500/network-resurrector/network-resurrector-api:$version-arm32v7
echo "DONE!"

View File

@ -1,26 +0,0 @@
#!/bin/bash
echo "Welcome!"
version="1.0.7"
platform="linux/amd64,linux/arm64"
localRegistryPass="***********"
databaseConnection="Server=#########;Database=#########;uid=#########;Password=#########;MultipleActiveResultSets=true"
identityServerBaseAddress="http://<hostname>:<port>/"
networkResurrectorServerBaseAddress="http://<hostname>:<port>/"
echo "Login to alpine-nexus registry."
docker login --username=admin --password=$localRegistryPass alpine-nexus:8500
echo "Create docker image with version $version for platform $platform"
docker buildx build \
--build-arg APP_VERSION=$version \
--build-arg DATABASE_CONNECTION=$databaseConnection \
--build-arg IDENTITY_SERVER_BASE_ADDRESS=$identityServerBaseAddress \
--build-arg NETWORK_RESURRECTOR_SERVER_BASE_ADDRESS=$networkResurrectorServerBaseAddress \
--platform $platform \
--output=type=image,push=true,registry.insecure=true \
--push \
--tag alpine-nexus:8500/network-resurrector/network-resurrector-api:$version \
-f "src/api/NetworkResurrector.Api/Docker/amd64/Dockerfile" .
echo "Done!"

View File

@ -1,22 +0,0 @@
#!/bin/sh
echo "Welcome!"
version="1.0.7"
oldver="1.0.6"
echo "Pull docker image network-resurrector-api:$version from registry."
docker pull alpine-nexus:8500/network-resurrector/network-resurrector-api:$version
echo "Stop old container."
docker stop network-resurrector-api && docker rm network-resurrector-api
echo "Run new container."
docker run -d --name network-resurrector-api --restart=always -p 5008:80 alpine-nexus:8500/network-resurrector/network-resurrector-api:$version
echo "Remove old image network-resurrector-api:$oldver."
docker rmi alpine-nexus:8500/network-resurrector/network-resurrector-api:$oldver
echo "Get container logs:"
docker logs network-resurrector-api
echo "DONE!"

View File

@ -1,45 +0,0 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build
WORKDIR /src
COPY dependencies.props .
COPY Directory.Build.props .
COPY NuGet.config .
COPY ["src/api/NetworkResurrector.Api/NetworkResurrector.Api.csproj", "NetworkResurrector.Api/"]
COPY ["src/api/NetworkResurrector.Api.Application/NetworkResurrector.Api.Application.csproj", "NetworkResurrector.Api.Application/"]
COPY ["src/api/NetworkResurrector.Api.PublishedLanguage/NetworkResurrector.Api.PublishedLanguage.csproj", "NetworkResurrector.Api.PublishedLanguage/"]
COPY ["src/api/NetworkResurrector.Api.Domain/NetworkResurrector.Api.Domain.csproj", "NetworkResurrector.Api.Domain/"]
COPY ["src/api/NetworkResurrector.Api.Domain.Data/NetworkResurrector.Api.Domain.Data.csproj", "NetworkResurrector.Api.Domain.Data/"]
RUN dotnet restore "NetworkResurrector.Api/NetworkResurrector.Api.csproj"
COPY src/api .
WORKDIR "/src/NetworkResurrector.Api"
RUN dotnet build "NetworkResurrector.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "NetworkResurrector.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENV urls="http://*:80"
ENV TZ=Europe/Bucharest
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ARG APP_VERSION=0.0.0.0
ENV APP_VERSION=${APP_VERSION}
ARG DATABASE_CONNECTION=""
ENV ConnectionStrings__DatabaseConnection=${DATABASE_CONNECTION}
ARG IDENTITY_SERVER_BASE_ADDRESS=""
ENV IdentityServer__BaseAddress=${IDENTITY_SERVER_BASE_ADDRESS}
ARG NETWORK_RESURRECTOR_SERVER_BASE_ADDRESS=""
ENV NetworkResurrectorServer__BaseAddress=${NETWORK_RESURRECTOR_SERVER_BASE_ADDRESS}
#Workaround to lower the TLS level in container for old sql server version
RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf
ENTRYPOINT ["dotnet", "NetworkResurrector.Api.dll", "--console"]

View File

@ -1,42 +0,0 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim-arm64v8 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim-arm64v8 AS build
WORKDIR /src
COPY dependencies.props .
COPY Directory.Build.props .
COPY NuGet.config .
COPY ["src/api/NetworkResurrector.Api/NetworkResurrector.Api.csproj", "NetworkResurrector.Api/"]
COPY ["src/api/NetworkResurrector.Api.Application/NetworkResurrector.Api.Application.csproj", "NetworkResurrector.Api.Application/"]
COPY ["src/api/NetworkResurrector.Api.PublishedLanguage/NetworkResurrector.Api.PublishedLanguage.csproj", "NetworkResurrector.Api.PublishedLanguage/"]
COPY ["src/api/NetworkResurrector.Api.Domain/NetworkResurrector.Api.Domain.csproj", "NetworkResurrector.Api.Domain/"]
COPY ["src/api/NetworkResurrector.Api.Domain.Data/NetworkResurrector.Api.Domain.Data.csproj", "NetworkResurrector.Api.Domain.Data/"]
RUN dotnet restore "NetworkResurrector.Api/NetworkResurrector.Api.csproj"
COPY src/api .
WORKDIR "/src/NetworkResurrector.Api"
RUN dotnet build "NetworkResurrector.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "NetworkResurrector.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENV urls="http://*:80"
ENV ConnectionStrings__DatabaseConnection="*********"
ENV IdentityServer__BaseAddress="*********"
ENV NetworkResurrectorServer__BaseAddress="*********"
ENV TZ=Europe/Bucharest
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ARG APP_VERSION=0.0.0.0
ENV APP_VERSION=${APP_VERSION}
#Workaround to lower the TLS level in container for old sql server version
RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf
ENTRYPOINT ["dotnet", "NetworkResurrector.Api.dll", "--console"]

View File

@ -1,10 +1,10 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim-arm32v7 AS base
FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim-arm32v7 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build
WORKDIR /src
COPY dependencies.props .
COPY Directory.Build.props .
@ -26,10 +26,8 @@ FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENV urls="http://*:80"
ENV ConnectionStrings__DatabaseConnection="*********"
ENV IdentityServer__BaseAddress="*********"
ENV NetworkResurrectorServer__BaseAddress="*********"
ENV AUTHOR="Tudor Stanciu"
ENV Urls="http://*:80"
ENV TZ=Europe/Bucharest
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
@ -39,4 +37,4 @@ ENV APP_VERSION=${APP_VERSION}
#Workaround to lower the TLS level in container for old sql server version
RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf
ENTRYPOINT ["dotnet", "NetworkResurrector.Api.dll", "--console"]
ENTRYPOINT ["dotnet", "NetworkResurrector.Api.dll"]

View File

@ -1,5 +1,5 @@
{
"urls": "http://*:5064",
"Urls": "http://*:5064",
"ConnectionStrings": {
"DatabaseConnection": "Server=#########;Database=#########;User Id=#########;Password=#########;MultipleActiveResultSets=true"
},