remove secrets from source code

master^2
Tudor Stanciu 2022-11-21 19:57:05 +02:00
parent 6c7c88b415
commit bda5cb5f50
5 changed files with 14 additions and 10 deletions

View File

@ -26,13 +26,15 @@ WORKDIR /app
COPY --from=publish /app/publish . COPY --from=publish /app/publish .
ENV urls="http://*:80" ENV urls="http://*:80"
ENV ConnectionStrings__DatabaseConnection="***REMOVED***"
ENV TZ=Europe/Bucharest ENV TZ=Europe/Bucharest
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ARG APP_VERSION=0.0.0.0 ARG APP_VERSION=0.0.0.0
ENV APP_VERSION=${APP_VERSION} ENV APP_VERSION=${APP_VERSION}
ARG DATABASE_CONNECTION
ENV ConnectionStrings__DatabaseConnection=${DATABASE_CONNECTION}
#Workaround to lower the TLS level in container for old sql server 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 RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf

View File

@ -1,7 +1,7 @@
{ {
"urls": "http://*:5055", "urls": "http://*:5055",
"ConnectionStrings": { "ConnectionStrings": {
"DatabaseConnection": "***REMOVED***" "DatabaseConnection": "Server=##########;Database=##########;User Id=##########;Password=##########;MultipleActiveResultSets=true"
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
@ -12,7 +12,7 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"Credentials": { "Credentials": {
"UserName": "***REMOVED***", "UserName": "**********",
"Password": "***REMOVED***" "Password": "**********"
} }
} }

View File

@ -1,7 +1,7 @@
Basic ***REMOVED*** Basic **********
############################################################################################## ##############################################################################################
Azure DevOps Repository Password: ***REMOVED*** Azure DevOps Repository Password: **********
############################################################################################## ##############################################################################################
Docker commands: Docker commands:
***************** *****************
@ -18,14 +18,14 @@ Push image to registry:
docker tag chatbot-api:1.0.5 cloud.canister.io:5000/tstanciu/chatbot:api-1.0.5 docker tag chatbot-api:1.0.5 cloud.canister.io:5000/tstanciu/chatbot:api-1.0.5
--login to registry --login to registry
docker login --username=tstanciu --password="***REMOVED***" cloud.canister.io:5000 docker login --username=tstanciu --password="**********" cloud.canister.io:5000
--push image --push image
docker push cloud.canister.io:5000/tstanciu/chatbot:api-1.0.5 docker push cloud.canister.io:5000/tstanciu/chatbot:api-1.0.5
Pull image from registry Pull image from registry
--login to registry with readonly rights --login to registry with readonly rights
docker login --username=deploy+tstanciu --password=***REMOVED*** cloud.canister.io:5000 docker login --username=deploy+tstanciu --password=********** cloud.canister.io:5000
--pull image --pull image
docker pull cloud.canister.io:5000/tstanciu/chatbot:api-1.0.5 docker pull cloud.canister.io:5000/tstanciu/chatbot:api-1.0.5

View File

@ -3,7 +3,7 @@
echo "Welcome!" echo "Welcome!"
version="1.0.0" version="1.0.0"
localRegistryPass="***REMOVED***" localRegistryPass="**********"
echo "Create docker image with version $version." echo "Create docker image with version $version."
docker image build -t "chatbot-api:$version" -f "Chatbot.Api/Dockerfile" . docker image build -t "chatbot-api:$version" -f "Chatbot.Api/Dockerfile" .

View File

@ -3,7 +3,8 @@ echo "Welcome!"
version="1.0.1" version="1.0.1"
platform="linux/amd64,linux/arm64" platform="linux/amd64,linux/arm64"
localRegistryPass="***REMOVED***" localRegistryPass="**********"
databaseConnection="#########"
echo "Login to alpine-nexus registry." echo "Login to alpine-nexus registry."
docker login --username=admin --password=$localRegistryPass alpine-nexus:8500 docker login --username=admin --password=$localRegistryPass alpine-nexus:8500
@ -11,6 +12,7 @@ docker login --username=admin --password=$localRegistryPass alpine-nexus:8500
echo "Create docker image with version $version for platform $platform" echo "Create docker image with version $version for platform $platform"
docker buildx build \ docker buildx build \
--build-arg APP_VERSION=$version \ --build-arg APP_VERSION=$version \
--build-arg DATABASE_CONNECTION=$databaseConnection \
--platform $platform \ --platform $platform \
--output=type=image,push=true,registry.insecure=true \ --output=type=image,push=true,registry.insecure=true \
--push \ --push \