dockerfile for arm32v7
parent
ca6aeb3e46
commit
d9e8d87083
|
@ -41,6 +41,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Api.Doma
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Api.Domain.Data", "src\api\NetworkResurrector.Api.Domain.Data\NetworkResurrector.Api.Domain.Data.csproj", "{509767A7-D11C-4143-8D45-01E62DFC2C74}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{DF5CBFF4-B348-4D4C-A6D4-B65BA1D64CEF}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
build-amd64.sh = build-amd64.sh
|
||||
build-arm32v7.sh = build-arm32v7.sh
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -104,6 +110,7 @@ Global
|
|||
{EE31B126-12EC-46B3-8FB4-AD5BCF14C029} = {43C78941-52E6-4AB8-9170-CC7C006E4784}
|
||||
{885D5625-028A-4B35-8C89-7EF718BC6E34} = {43C78941-52E6-4AB8-9170-CC7C006E4784}
|
||||
{509767A7-D11C-4143-8D45-01E62DFC2C74} = {43C78941-52E6-4AB8-9170-CC7C006E4784}
|
||||
{DF5CBFF4-B348-4D4C-A6D4-B65BA1D64CEF} = {FDDE879C-E0A3-4BF1-945F-7FEA324C8EBA}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {351D76E9-FE02-4C30-A464-7B29AFC64BC7}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
echo "Welcome!"
|
||||
|
||||
version="1.0.0"
|
||||
localRegistryPass="***REMOVED***"
|
||||
|
||||
echo "Login to dockerhub registry."
|
||||
docker login --username=tstanciu --password=$dockerHubRegistryPass
|
||||
|
||||
echo "Create docker image with version $version."
|
||||
docker image build -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!"
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
echo "Welcome!"
|
||||
|
||||
version="1.0.0"
|
||||
localRegistryPass="***REMOVED***"
|
||||
dockerHubRegistryPass="***REMOVED***"
|
||||
|
||||
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 --platform linux/arm/v7 -t "tstanciu/sta-registry:network-resurrector-api-$version-arm32v7" -f "src/api/NetworkResurrector.Api/Docker/arm32v7/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!"
|
|
@ -0,0 +1,37 @@
|
|||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
ARG BASE_IMAGE_VERSION
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:$BASE_IMAGE_VERSION AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster 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.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="***REMOVED***"
|
||||
ENV IdentityServer__BaseAddress="http://***REMOVED***/"
|
||||
|
||||
#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"]
|
|
@ -1,4 +1,4 @@
|
|||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
#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/core/aspnet:3.1-buster-slim AS base
|
||||
WORKDIR /app
|
|
@ -0,0 +1,35 @@
|
|||
#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/core/aspnet:3.1-buster-slim-arm32v7 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster 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.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="***REMOVED***"
|
||||
ENV IdentityServer__BaseAddress="http://***REMOVED***/"
|
||||
|
||||
#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"]
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Create image:
|
||||
--from solution folder:
|
||||
docker image build -t "network-resurrector-api:1.0.1" -f "src/api/NetworkResurrector.Api/Dockerfile" .
|
||||
docker image build -t "network-resurrector-api:1.0.1" -f "src/api/NetworkResurrector.Api/Docker/amd64/Dockerfile" .
|
||||
|
||||
Run image:
|
||||
docker run -p 5053:80 -it network-resurrector-api:1.0.1
|
||||
|
@ -30,6 +30,7 @@ docker rm network-resurrector-api
|
|||
|
||||
Run container in prod env
|
||||
docker run -d --name network-resurrector-api --restart=always -p 5008:80 alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1
|
||||
docker run -d --name network-resurrector-api --restart=always -p 5008:80 tstanciu/sta-registry:nr-api-1.0.1-arm
|
||||
|
||||
Remove old image
|
||||
docker rmi alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.0
|
|
@ -0,0 +1,33 @@
|
|||
Docker commands:
|
||||
*****************
|
||||
|
||||
Create image and push it:
|
||||
--login to registry
|
||||
docker login --username=tstanciu --password="***REMOVED***"
|
||||
|
||||
--from solution folder:
|
||||
docker buildx build --platform linux/arm/v7 -t "tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7" -f "src/api/NetworkResurrector.Api/Docker/arm32v7/Dockerfile" --push .
|
||||
|
||||
# With insecure registry
|
||||
docker buildx build --platform linux/arm/v7 -t "alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1-arm" -f "src/api/NetworkResurrector.Api/Docker/arm32v7/Dockerfile" --push .
|
||||
https://docs.docker.com/engine/reference/commandline/buildx_create/
|
||||
https://stackoverflow.com/questions/63409755/how-to-use-docker-buildx-pushing-image-to-registry-use-http-protocol
|
||||
|
||||
|
||||
Pull image from registry
|
||||
--login to registry
|
||||
|
||||
--pull image
|
||||
docker pull tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7
|
||||
|
||||
Stop old container
|
||||
docker stop network-resurrector-api && docker rm network-resurrector-api
|
||||
|
||||
Run container in prod env
|
||||
docker run -d --name network-resurrector-api --restart=always -p 5008:80 tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7
|
||||
|
||||
Remove old image
|
||||
docker rmi tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7
|
||||
|
||||
docker run -d --name network-resurrector-api --restart=always -p 5008:80 alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1
|
||||
#######################################################################################################################################################
|
Loading…
Reference in New Issue