84 lines
2.1 KiB
Docker
84 lines
2.1 KiB
Docker
#######################
|
|
## Build Webserver ##
|
|
#######################
|
|
|
|
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build-Webserver
|
|
WORKDIR /WebServer
|
|
|
|
# Copy the csproj
|
|
COPY ./WebServer/Webserver.csproj ./
|
|
|
|
# Restore the Server
|
|
RUN dotnet restore './Webserver.csproj'
|
|
|
|
# Copy the rest of the backend over
|
|
COPY ./WebServer/ ./
|
|
|
|
# Get the target arch
|
|
ARG TARGETARCH
|
|
|
|
# Build the source
|
|
RUN set -e && \
|
|
if [ "$TARGETARCH" = "arm64" ]; then RID="linux-arm64"; \
|
|
elif [ "$TARGETARCH" = "amd64" ]; then RID="linux-x64"; \
|
|
else echo "Unsupported ARCH: $TARGETARCH"; exit 1; \
|
|
fi && \
|
|
dotnet publish './Server.csproj' -c Release -r ${RID} -o /app/publish
|
|
|
|
################
|
|
## Publish ##
|
|
################
|
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0
|
|
|
|
# Pull in required libraries to build python from source
|
|
RUN apt update && apt upgrade && apt install -y \
|
|
build-essential \
|
|
zlib1g-dev \
|
|
libncurses5-dev \
|
|
libgdbm-dev \
|
|
libnss3-dev \
|
|
libssl-dev \
|
|
libreadline-dev \
|
|
libffi-dev \
|
|
libsqlite3-dev \
|
|
libbz2-dev \
|
|
wget \
|
|
ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Download, extract, configure, and compile python 3.11
|
|
# Use Hardlinks and altinstall to not break system components that rely on the builtin python
|
|
RUN wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz && \
|
|
tar -xf Python-3.11.0.tgz && \
|
|
cd Python-3.11.0 && \
|
|
./configure --enable-optimizations && \
|
|
make -j$(nproc) && \
|
|
make altinstall && \
|
|
cd .. && \
|
|
rm -rf Python-3.11.0.tgz Python-3.11.0 && \
|
|
ln -s /usr/local/bin/python3.11 /usr/local/bin/python && \
|
|
ln -s /usr/local/bin/pip3.11 /usr/local/bin/pip
|
|
|
|
RUN pip install --upgrade pip && \
|
|
pip install tensorflow \
|
|
fastparquet \
|
|
openpyxl \
|
|
yfinance
|
|
|
|
WORKDIR /app
|
|
|
|
ENV ASPNETCORE_HTTP_PORTS=5000
|
|
ENV StripeKey=null
|
|
ENV MySQLServer=null
|
|
ENV MySQLUser=null
|
|
ENV MySQLPass=null
|
|
ENV MySQLDatabase=Mistox
|
|
|
|
EXPOSE 5000
|
|
|
|
# Copy in the webserver
|
|
COPY --from=build-Webserver /app/publish ./
|
|
|
|
# Start the container
|
|
ENTRYPOINT ["dotnet", "MistoxWebsite.Server.dll", "--url", "http://localhost:5000"] |