Skip to content

Commit

Permalink
Simplify Dockerfile.sm
Browse files Browse the repository at this point in the history
Also attempt to copy out missing `wwwroot`
  • Loading branch information
carlreid committed Feb 12, 2025
1 parent 7cfc064 commit fd82dbd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
39 changes: 11 additions & 28 deletions Dockerfile.sm.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,18 @@ WORKDIR /src
# Copy all files into the image
COPY . .

# Step 1: Restore and build the .NET project with error-only output but keep echo messages
RUN echo "Starting .NET restore..." && \
dotnet restore "StreamMaster.API/StreamMaster.API.csproj" -a $TARGETARCH --verbosity m && \
echo ".NET restore completed successfully." || echo "Error during .NET restore!" && \
\
echo "Starting .NET build..." && \
dotnet build "StreamMaster.API/StreamMaster.API.csproj" -c Debug -o /app/build -a $TARGETARCH --verbosity m && \
echo ".NET build completed successfully." || echo "Error during .NET build!"

# Step 2: Install npm packages, build the frontend, and copy to wwwroot with error-only output but keep echo messages
RUN echo "Navigating to frontend directory: /src/streammasterwebui" && \
cd /src/streammasterwebui && \
echo "Installing npm dependencies..." && \
# Build UI
WORKDIR /src/streammasterwebui
RUN echo "Building frontend..." && \
npm install --silent && \
echo "npm install completed successfully." || echo "Error during npm install!" && \
\
echo "Building frontend with npm run build..." && \
npm run build --silent && \
echo "Frontend build completed successfully." || echo "Error during frontend build!" && \
\
echo "Copying frontend build files to /src/StreamMaster.API/wwwroot/..." && \
cp -r dist/* /src/StreamMaster.API/wwwroot/ && \
echo "Files copied to wwwroot successfully." || echo "Error copying files to wwwroot!"
mkdir -p /src/StreamMaster.API/wwwroot && \
cp -r dist/* /src/StreamMaster.API/wwwroot/

# Publish the .NET application with error-only output but keep echo messages
WORKDIR "/src/StreamMaster.API"
RUN echo "Publishing .NET application..." && \
dotnet publish --no-restore "StreamMaster.API.csproj" -c Debug -o /app/publish /p:UseAppHost=false -a $TARGETARCH --verbosity m && \
echo ".NET publish completed successfully." || echo "Error during .NET publish!"
# Build and publish API
WORKDIR /src/StreamMaster.API
RUN dotnet restore "StreamMaster.API.csproj" -a $TARGETARCH --verbosity m && \
dotnet publish "StreamMaster.API.csproj" -c Debug -o /app/publish /p:UseAppHost=false -a $TARGETARCH --verbosity m

# Clean up source files
#RUN rm -rf /src
# Verify the wwwroot directory contents
RUN ls -la /app/publish/wwwroot || true
1 change: 1 addition & 0 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ENV PUID=0
ENV PGID=0

COPY --from=sm /app/publish .
COPY --from=sm /app/publish/wwwroot ./wwwroot

COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-ensure-initdb.sh
Expand Down

0 comments on commit fd82dbd

Please sign in to comment.