FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine
# Install Node.js - we use Node.js 20 here, pick another version if you like that
RUN apk update \
&& apk add --no-cache curl \
&& curl -sL https://deb.nodesource.com/setup_20.x \
&& apk add --no-cache nodejs npm build-base
WORKDIR /app
# RUN npm init -y
RUN npm install -g nswag
docker build -t <your tag> .
docker run --rm --volume "${PWD}:/app" generator npx nswag openapi2csclient /input:https://<base_url>/swagger/v1/swagger.json /classname:GeneratedClient /namespace:Namespace /output:GeneratedClient.cs
After running the docker run
command above you should now see a new file called GeneratedClient.cs
.
FROM mcr.microsoft.com/dotnet/sdk:8.0
# Install Node.js
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -yq curl
# We use Node.js 20 here, pick another version if you like that
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -yq nodejs build-essential
WORKDIR /app
# RUN npm init -y
RUN npm install -g nswag