Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion .dockerignore → docker/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ macos/
windows/
android/
ios/
*.iml
*.iml
11 changes: 6 additions & 5 deletions Dockerfile → docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@ RUN flutter pub get
# Copy the rest of your app's source code
COPY . .

RUN dart run fix_isar_web.dart

# Build the web app for production
RUN flutter build web --release
# Build the web app for production with WASM
RUN flutter build web --wasm --release

# ==========================================
# Stage 2: Serve the App with Nginx
# ==========================================
# Use a lightweight Nginx image
FROM nginx:alpine

# Copy the custom nginx.conf
COPY docker/nginx.conf /etc/nginx/nginx.conf

# Copy the compiled web files from the 'build' stage to Nginx's public folder
COPY --from=build /app/build/web /usr/share/nginx/html

# Expose port 80 to the outside world
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx", "-g", "daemon off;"]
29 changes: 29 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;

# Required for Flutter Web WASM
add_header Cross-Origin-Embedder-Policy require-corp;
add_header Cross-Origin-Opener-Policy same-origin;
}

# Ensure correct MIME types for WASM and JS
types {
application/wasm wasm;
application/javascript js;
}
}
}
Loading