diff --git a/Dockerfile b/Dockerfile index a71c86e..34d305b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"] +