-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (46 loc) · 1.48 KB
/
Copy pathDockerfile
File metadata and controls
64 lines (46 loc) · 1.48 KB
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
56
57
58
59
60
61
62
63
64
# Multi-stage build for F# API + Webpack Web project
FROM node:18-alpine AS web-build
# Set working directory for web build
WORKDIR /app/web
# Copy web project files
COPY web/package.json web/yarn.lock ./
RUN yarn install --frozen-lockfile
# Copy web source and build
COPY web/ ./
ENV URL=cards.joebad.com
RUN yarn build
# F# build stage
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS api-build
# Set working directory for API build
WORKDIR /app/api
# Copy F# project files and restore dependencies
COPY api/*.fsproj ./
RUN dotnet restore
# Copy API source code
COPY api/ ./
# Copy built web assets to wwwroot
COPY --from=web-build /app/web/dist ./wwwroot/
# Build the F# application
RUN dotnet publish -c Release -o out
# Runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:9.0
# Create app directory
WORKDIR /app
# Copy the published API application
COPY --from=api-build /app/api/out ./
# Create directory for SQLite database with proper permissions
RUN mkdir -p /app/data && chown -R app:app /app/data
# Copy existing database if it exists (optional - comment out if database doesn't exist yet)
# COPY api/blackjack.db /app/data/blackjack.db
# Set environment variables
ENV ASPNETCORE_ENVIRONMENT=Production
ENV ASPNETCORE_URLS=http://+:5001
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
# Expose port
EXPOSE 5001
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:5001/health || exit 1
# Start the application
ENTRYPOINT ["dotnet", "Api.dll"]