Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
368 views
in Technique[技术] by (71.8m points)

bash - First and last line are not running in sh shell script

I don't know what's wrong with this script I run it through dockerfile but unfortunately, the line where I install wget and last lines are not running any idea on what about could the mistake?

here is the script

#!/bin/bash
   

apt-get upgrade;
apt-get install -y wget;

wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

dpkg -i packages-microsoft-prod.deb;

apt-get update; 
apt-get install -y apt-transport-https && 
apt-get update && 
apt-get install -y dotnet-sdk-3.1;

dotnet tool install -g dotnet-ef --version 3.1.9;

export PATH=$PATH:/root/.dotnet/tools

and comes my dockerfile:

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app

EXPOSE 5001
ENV ASPNETCORE_URLS=http://*:5001

# Prefiltering stage using find -exec and cp --parents to copy out
# the project files in their proper directory structure.
COPY . ./src/
RUN mkdir ./proj && cd ./src && 
    find . -type f -a ( -iname "*.sln" -o -iname "*.csproj" ) 
    -exec cp --parents "{}" ../proj/ ;

WORKDIR "/src/IdentityApi/"
COPY /src/IdentityApi/khotabaa.pfx /app/khotabaa.pfx

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
COPY . .
WORKDIR "/src/IdentityApi"
RUN dotnet build "IdentityApi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "IdentityApi.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .


USER root

COPY migrations.sh migrations.sh
RUN chmod +x migrations.sh
CMD /bin/bash ./migrations.sh

I try to run a script from the docker file to be able to install Dotnet tools to be used further. please I have been struggling with it for hours and I don't find the reason for that:(

Regards

question from:https://stackoverflow.com/questions/65854041/first-and-last-line-are-not-running-in-sh-shell-script

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...