-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
42 lines (32 loc) · 1.08 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
# QEMU crashes when building arm64 container, so we use this pattern to create a multi-platform build:
# https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support/
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
# implicitly set by docker build
ARG TARGETARCH
# install nodejs/npm to build cc-implementation
RUN apk update && apk add --no-cache nodejs npm
WORKDIR /app
COPY ./src .
# regenerate index.html from source
RUN \
cd /app/cc-implementation && \
npm install && \
npm run build
# compile PushTX app for target architecture (arm64/amd64)
RUN \
cd /app/PushTX && \
dotnet restore -a $TARGETARCH && \
dotnet publish -a $TARGETARCH --no-restore -c Release -o out
# start from aspnet runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
# install nginx and yq
RUN \
apk update && \
apk add --no-cache nginx yq && \
rm -rf \
/tmp/* \
/var/cache/apk/* \
/var/tmp/*
WORKDIR /app
COPY --chmod=755 ./docker_entrypoint.sh /app/docker_entrypoint.sh
COPY --from=build /app/PushTX/out /app