Alot of changes

This commit is contained in:
ImBenji
2024-05-01 12:29:59 +01:00
parent 8cc4016836
commit fc4d3ef898
23 changed files with 1755 additions and 430 deletions

View File

@@ -1,36 +1,47 @@
# Install Operating system and dependencies
FROM ubuntu:20.04
# Environemnt to install flutter and build web
FROM debian:latest AS build-env
ENV DEBIAN_FRONTEND noninteractive
# install all needed stuff
RUN apt-get update
RUN apt-get install -y curl git unzip
RUN apt-get update
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3
RUN apt-get clean
# define variables
ARG FLUTTER_SDK=/usr/local/flutter
ARG FLUTTER_VERSION=3.19.5
ARG APP=/app/
# download Flutter SDK from Flutter Github repo
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
#clone flutter
RUN git clone https://github.com/flutter/flutter.git $FLUTTER_SDK
# change dir to current flutter folder and make a checkout to the specific version
RUN cd $FLUTTER_SDK && git fetch && git checkout $FLUTTER_VERSION
# Set flutter environment path
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
# setup the flutter path as an enviromental variable
ENV PATH="$FLUTTER_SDK/bin:$FLUTTER_SDK/bin/cache/dart-sdk/bin:${PATH}"
# Run flutter doctor
RUN flutter doctor
# Start to run Flutter commands
# doctor to see if all was installes ok
RUN flutter doctor -v
# Enable flutter web
RUN flutter channel master
RUN flutter upgrade
RUN flutter config --enable-web
# create folder to copy source code
RUN mkdir $APP
# copy source code to folder
COPY . $APP
# stup new folder as the working directory
WORKDIR $APP
# Copy files to container and build
RUN mkdir /app/
COPY . /app/
WORKDIR /app/
# Run build: 1 - clean, 2 - pub get, 3 - build web
RUN flutter clean
RUN flutter pub get
RUN flutter build web
# Record the exposed port
EXPOSE 5000
# once heare the app will be compiled and ready to deploy
# make server startup script executable and start the web server
RUN ["chmod", "+x", "/app/server/server.sh"]
# use nginx to deploy
FROM nginx:1.25.2-alpine
ENTRYPOINT [ "/app/server/server.sh"]
# 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;"]