From 5ba8fe384d058875f6ea0190b37da39f220e6e9c Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 9 Jun 2023 01:19:29 +0200 Subject: [PATCH] feat(app): Add Dockerfile for web Signed-off-by: jld3103 --- .cspell/misc.txt | 1 + .dockerignore | 10 ++++++++++ packages/app/Dockerfile | 20 ++++++++++++++++++++ packages/app/nginx.conf | 4 ++++ 4 files changed, 35 insertions(+) create mode 100644 .dockerignore create mode 100644 packages/app/Dockerfile create mode 100644 packages/app/nginx.conf diff --git a/.cspell/misc.txt b/.cspell/misc.txt index 94f59994..9ede053f 100644 --- a/.cspell/misc.txt +++ b/.cspell/misc.txt @@ -9,3 +9,4 @@ postmarket provokateurin subroutes uncategorized +leoafarias diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..f5eb0812 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +**/.dart_tool +**/build +**/coverage +.git/ +external/ +packages/app/.flatpak-builder +packages/app/android +packages/app/build-dir +packages/app/linux +packages/app/screenshots diff --git a/packages/app/Dockerfile b/packages/app/Dockerfile new file mode 100644 index 00000000..6faab925 --- /dev/null +++ b/packages/app/Dockerfile @@ -0,0 +1,20 @@ +FROM leoafarias/fvm:latest as build + +# This is needed, because for some reason it doesn't work with the default user because of permissions +USER root +WORKDIR /app + +COPY .fvm/fvm_config.json .fvm/ +RUN fvm install +RUN fvm flutter config --enable-web +RUN fvm flutter precache + +# TODO: Efficiently cache dependencies + +COPY . . + +RUN cd packages/app && fvm flutter build web --no-web-resources-cdn + +FROM nginx:alpine +COPY packages/app/nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/packages/app/build/web/ /usr/share/nginx/html diff --git a/packages/app/nginx.conf b/packages/app/nginx.conf new file mode 100644 index 00000000..b2c4aae9 --- /dev/null +++ b/packages/app/nginx.conf @@ -0,0 +1,4 @@ +server { + listen 8080; + root /usr/share/nginx/html; +}