-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
55 lines (49 loc) · 1.83 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS builder
WORKDIR /source
# COPY backend/* .
COPY backend/**/*.csproj .
RUN for file in $(ls *.csproj); do mkdir -p ${file%.*}/ && mv $file ${file%.*}/; done
COPY backend/MySolution.sln .
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
dotnet restore MySolution.sln \
--runtime linux-musl-x64
COPY backend .
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
dotnet publish -c Release -o /app \
--no-restore \
--packages /root/.nuget/packages \
--runtime linux-musl-x64 \
--self-contained true \
--no-cache /restore \
#/p:PublishTrimmed=true \ #Not working in dotnet8
/p:PublishSingleFile=true
FROM --platform=$BUILDPLATFORM node:18.12-alpine3.16 AS client-builder
WORKDIR /ui
# cache packages in layer
COPY ui/package.json /ui/package.json
COPY ui/package-lock.json /ui/package-lock.json
RUN --mount=type=cache,target=/usr/src/app/.npm \
npm set cache /usr/src/app/.npm && \
npm ci
# install
COPY ui /ui
RUN npm run build
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine
LABEL org.opencontainers.image.title="Azure Kubernetes Services" \
org.opencontainers.image.description="Azure Kubernetes Services Extension to manage kubernetes on Azure" \
org.opencontainers.image.vendor="AzureTar" \
com.docker.desktop.extension.api.version="0.3.4" \
com.docker.extension.screenshots="" \
com.docker.desktop.extension.icon="" \
com.docker.extension.detailed-description="" \
com.docker.extension.publisher-url="" \
com.docker.extension.additional-urls="" \
com.docker.extension.categories="" \
com.docker.extension.changelog=""
COPY --from=builder /app .
COPY docker-compose.yaml .
COPY metadata.json .
COPY docker.svg .
COPY --from=client-builder /ui/build ui
CMD ./MyAPI