Mr
I have a mono repo that has a multi-stage docker file and from that I’m trying to deploy two components (web service and static site).
Here is my docker file
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /app
COPY . .
RUN dotnet tool restore
RUN dotnet restore
RUN dotnet publish src/Server -c release -o /deploy/server
RUN dotnet fable src/Client
FROM node:12 AS client
WORKDIR /app
COPY --from=build /app ./
RUN npm install
RUN npm run build
FROM mcr.microsoft.com/dotnet/runtime:5.0 AS server
WORKDIR /deploy/server
COPY --from=build /deploy/server ./
EXPOSE 80
ENTRYPOINT ["dotnet", "Server.dll"]
My webservice component works fine as the **server **stage is the last stage but the static site I’m not sure how to tell App Platform to stop at client
From what I understand you can tell docker to stop at a specific stage.
What is the best way to achieve this using App Platform?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @TWith2Sugars!
What I’d recommend is splitting your Dockerfiles into two, like so:
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /app
COPY . .
RUN dotnet tool restore
RUN dotnet restore
RUN dotnet publish src/Server -c release -o /deploy/server
RUN dotnet fable src/Client
FROM mcr.microsoft.com/dotnet/runtime:5.0 AS server
WORKDIR /deploy/server
COPY --from=build /deploy/server ./
EXPOSE 80
ENTRYPOINT ["dotnet", "Server.dll"]
FROM node:12 AS client
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
Then, you can set the dockerfile_path property on your Service component to Dockerfile.server and Dockerfile.client on your Static Site component. Make sure to set the output directory on the Static Site to /app/dist or wherever the files are generated.
You’ll need to edit your app specification directly using doctl to set the dockerfile_path field.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.