2024-04-04 16:15:30 +00:00
|
|
|
FROM debian:latest AS build-env
|
|
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install -y curl tar xz-utils git
|
|
|
|
|
|
|
|
# define variables
|
|
|
|
ARG FLUTTER_SDK=/usr/local/flutter
|
|
|
|
RUN mkdir -p ${FLUTTER_SDK}
|
|
|
|
ARG FLUTTER_VERSION=3.19.5
|
|
|
|
ARG APP=/app/
|
|
|
|
|
|
|
|
RUN curl -l -o /tmp/flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz
|
|
|
|
RUN tar -xf /tmp/flutter.tar.xz -C /usr/local
|
|
|
|
ENV PATH="$FLUTTER_SDK/bin:$FLUTTER_SDK/bin/cache/dart-sdk/bin:${PATH}"
|
|
|
|
|
|
|
|
WORKDIR $APP
|
2024-05-22 11:03:44 +00:00
|
|
|
COPY . $APP
|
|
|
|
|
2024-04-19 11:19:44 +00:00
|
|
|
RUN flutter build web --release
|
2024-04-04 16:15:30 +00:00
|
|
|
|
|
|
|
# once heare the app will be compiled and ready to deploy
|
|
|
|
|
|
|
|
# use nginx to deploy
|
|
|
|
FROM nginx
|
|
|
|
|
|
|
|
# copy the info of the builded web app to nginx
|
|
|
|
COPY --from=build-env /app/build/web /usr/share/nginx/html
|
|
|
|
|
|
|
|
# Expose and run nginx
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|