updated docker file
This commit is contained in:
14
.dockerignore
Normal file
14
.dockerignore
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
.git
|
||||||
|
.github
|
||||||
|
.dart_tool
|
||||||
|
build
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
.claude
|
||||||
|
android
|
||||||
|
ios
|
||||||
|
macos
|
||||||
|
linux
|
||||||
|
windows
|
||||||
|
test
|
||||||
|
**/*.iml
|
||||||
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Flutter web build, served as static files by nginx.
|
||||||
|
#
|
||||||
|
# Dokploy builds this repo with its Dockerfile provider, so the image does the
|
||||||
|
# whole job: pull the Flutter SDK, compile the web bundle, hand the output to a
|
||||||
|
# web server. Nothing from the build stage survives into the final image but
|
||||||
|
# build/web.
|
||||||
|
|
||||||
|
FROM ghcr.io/cirruslabs/flutter:stable AS build
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Dependencies resolve from the pubspec alone, so copying it first keeps the
|
||||||
|
# `pub get` layer cached across source-only changes.
|
||||||
|
COPY pubspec.yaml pubspec.lock ./
|
||||||
|
RUN flutter pub get
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN flutter build web --release
|
||||||
|
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY --from=build /app/build/web /usr/share/nginx/html
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
26
nginx.conf
Normal file
26
nginx.conf
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# go_router owns the URL, so any path that is not a real file has to come
|
||||||
|
# back as index.html rather than a 404 — otherwise a reload on /permissions
|
||||||
|
# or a shared link lands on nothing.
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build output is content-hashed, the shell is not: caching index.html or
|
||||||
|
# the service worker would pin returning workers to the previous release.
|
||||||
|
location = /index.html {
|
||||||
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||||
|
}
|
||||||
|
location = /flutter_service_worker.js {
|
||||||
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||||
|
}
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml application/wasm;
|
||||||
|
gzip_min_length 1024;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user