File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build-env
2+
3+ LABEL maintainer="Stef Heyenrath"
4+
5+ WORKDIR /app
6+
7+ # copy csproj and restore as distinct layers
8+ COPY StandAlone.NETCoreApp.csproj ./
9+ RUN dotnet restore
10+
11+ # copy everything else and build
12+ COPY *.cs ./
13+ RUN dotnet publish -c Release -r alpine-x64 -o out \
14+ --self-contained true \
15+ /p:PublishTrimmed=true \
16+ /p:TrimMode=Link \
17+ /p:PublishSingleFile=true
18+
19+ # build runtime image
20+ FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
21+ # resolve CVE-2023-2975
22+ RUN apk upgrade libssl3 libcrypto3 --no-cache
23+ WORKDIR /app
24+ COPY --from=build-env /app/out ./
25+ EXPOSE 80
26+ ENTRYPOINT ["./wiremock-net", "--Urls", "http://*:80"]
27+ CMD ["--WireMockLogger", "WireMockConsoleLogger"]
28+
29+ # Just some info:
30+ # build with : docker build -t sheyenrath/wiremock.net .
31+ # run with : docker run --rm -p 9091:80 sheyenrath/wiremock.net
Original file line number Diff line number Diff line change 1+ docker build - t sheyenrath/ wiremock.net- alpine -f .\Dockerfile.alpine .
2+ docker rmi $ (docker images -f " dangling=true" - q)
3+ docker images
Original file line number Diff line number Diff line change 1+ variables :
2+ buildConfiguration : ' Release'
3+ imageName : ' wiremock.net-alpine'
4+ buildProjects : ' **/StandAlone.NETCoreApp.csproj'
5+ tag : ' 1.5.32'
6+
7+ trigger : none
8+
9+ pool :
10+ vmImage : ' Ubuntu-latest'
11+
12+ steps :
13+ - task : UseDotNet@2
14+ inputs :
15+ packageType : ' sdk'
16+ version : ' 6.0.x'
17+
18+ - task : DotNetCoreCLI@2
19+ displayName : Build StandAlone.NETCoreApp
20+ inputs :
21+ command : ' build'
22+ arguments : /p:Configuration=$(buildConfiguration)
23+ projects : $(buildProjects)
24+
25+ - task : Docker@2
26+ displayName : ' Build Docker [$(imageName)(latest,$(tag)]'
27+ inputs :
28+ command : ' build'
29+ containerRegistry : ' DockerRegistry'
30+ repository : ' $(DOCKER_ID)/$(imageName)'
31+ dockerfile : ' $(Build.SourcesDirectory)/StandAlone.NETCoreApp/Dockerfile.alpine'
32+ tags : |
33+ $(tag)
34+ latest
35+
36+ - task : Docker@2
37+ displayName : ' Push Docker [$(imageName)(latest,$(tag)]'
38+ inputs :
39+ command : ' push'
40+ containerRegistry : ' DockerRegistry'
41+ repository : ' $(DOCKER_ID)/$(imageName)'
42+ dockerfile : ' $(Build.SourcesDirectory)/StandAlone.NETCoreApp/Dockerfile.alpine'
43+ tags : |
44+ $(tag)
45+ latest
You can’t perform that action at this time.
0 commit comments