我是新来的Docker。希望有人能回答这个问题。我想有一个与Azure功能运行时以及mruby安装在它的容器。我确实有两个脚本,但不知道如何组合它们
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/azure-functions/dotnet:3.0 AS base
WORKDIR /home/site/wwwroot
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["FunctionApp1/FunctionApp1.csproj", "FunctionApp1/"]
RUN dotnet restore "FunctionApp1/FunctionApp1.csproj"
COPY . .
WORKDIR "/src/FunctionApp1"
RUN dotnet build "FunctionApp1.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "FunctionApp1.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /home/site/wwwroot
COPY --from=publish /app/publish .
ENV AzureWebJobsScriptRoot=/home/site/wwwroot
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
和一个来自https://github.com/nacyot/docker-programming-languages/blob/master/ruby-mruby-1.0.0/Dockerfile
的rubyFROM nacyot/ruby-ruby:2.1.2 as extra
WORKDIR /opt
# Install base packages
RUN apt-get install -y bison
# Install mruby
RUN wget https://github.com/mruby/mruby/archive/3.0.0.zip
RUN unzip 3.0.0.zip
RUN mv mruby-3.0.0 mruby
RUN cd mruby; make
RUN bash -c "ln -s /opt/mruby/bin/{mirb,mrbc,mruby} /usr/local/bin/"
似乎是一个非常基本的任务,但我找不到解决方案。它必须是一个dockerfile -调试我的Azure功能应用程序与mruby的存在
谢谢。
找到了有用的东西。试错复制
FROM nacyot/ruby-ruby:2.1.2 as extra
WORKDIR /opt
# Install base packages
RUN apt-get install -y bison
# Install mruby
RUN wget https://github.com/mruby/mruby/archive/3.0.0.zip
RUN unzip 3.0.0.zip
RUN mv mruby-3.0.0 mruby
RUN cd mruby; make
RUN bash -c "ln -s /opt/mruby/bin/{mirb,mrbc,mruby} /usr/local/bin/"
FROM mcr.microsoft.com/azure-functions/dotnet:3.0 AS base
WORKDIR /home/site/wwwroot
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["FunctionApp1/FunctionApp1.csproj", "FunctionApp1/"]
RUN dotnet restore "FunctionApp1/FunctionApp1.csproj"
COPY . .
WORKDIR "/src/FunctionApp1"
RUN dotnet build "FunctionApp1.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "FunctionApp1.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /home/site/wwwroot
COPY --from=publish /app/publish .
COPY --from=extra /root/.rbenv /root/.rbenv
COPY --from=extra /usr/local/sbin /usr/local/sbin
COPY --from=extra /usr/sbin /user/sbin
COPY --from=extra /usr/local/bin /usr/local/bin
COPY --from=extra /usr/bin /usr/bin
COPY --from=extra /sbin /sbin
COPY --from=extra /bin /bin
COPY --from=extra /lib/x86_64-linux-gnu/libreadline.so.6 /lib/x86_64-linux-gnu/libreadline.so.6
COPY --from=extra /lib/x86_64-linux-gnu/libtinfo.so.5 /lib/x86_64-linux-gnu/libtinfo.so.5
COPY --from=extra /opt/mruby/bin /opt/mruby/bin
ENV AzureWebJobsScriptRoot=/home/site/wwwroot
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
HOME=/root
CONFIGURE_OPTS=--disable-install-doc
LC_ALL=en_US.UTF-8
ENV PATH="/root/.rbenv/bin:/root/.rbenv/shims:${PATH}"