Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Build:
# docker build -t simplicity-webide .
#
# Run:
# docker run -d -p 8080:80 --name simplicity-webide simplicity-webide

# Stage 1: Builder
# This stage installs all dependencies and builds the application.
FROM debian:bookworm-slim AS builder
Expand Down Expand Up @@ -37,17 +43,28 @@ ENV CFLAGS_wasm32_unknown_unknown="-I/usr/lib/clang/16/include"
WORKDIR /app
COPY . .

# Build the application
RUN trunk build --release && \
sh fix-links.sh
# Build the application WITHOUT the fix-links.sh script (for local deployment)
RUN trunk build --release

# Stage 2: Final Image
# This stage creates a minimal image to serve the built static files.
FROM nginx:1.27-alpine-slim

# Copy custom nginx configuration for proper routing
RUN echo 'server { \
listen 80; \
server_name localhost; \
root /usr/share/nginx/html; \
index index.html; \
location / { \
try_files $uri $uri/ /index.html; \
} \
}' > /etc/nginx/conf.d/default.conf

# Copy the built assets from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html

# Expose port 80 and start Nginx
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx", "-g", "daemon off;"]