oc-front/Dockerfile

64 lines
2.0 KiB
Docker
Raw Normal View History

# Environemnt to install flutter and build web
FROM debian:latest AS build-env
# install all needed stuff
RUN apt-get update
RUN apt-get install -y curl git unzip
2024-10-15 11:28:29 +02:00
ARG WORKSPACE_HOST="http://localhost:8089/oc"
ARG WORKFLOW_HOST="http://localhost:8088/oc"
ARG ITEM_HOST="http://localhost:8087/oc"
ARG SCHEDULER_HOST="http://localhost:8090/oc"
2024-08-22 15:46:16 +02:00
ARG LOGS_HOST="http://localhost:3100"
2024-11-08 13:59:22 +01:00
ARG PEER_HOST="http://localhost:8093/oc"
2024-11-13 08:12:37 +01:00
ARG DATACENTER_HOST="http://localhost:8092/oc"
2024-11-08 13:59:22 +01:00
ARG COLLABORATIVE_AREA_HOST="http://localhost:8091/oc"
2024-11-19 15:06:22 +01:00
ARG AUTH_MODE=true
# define variables
2024-11-19 15:06:22 +01:00
ARG FLUTTER_SDK=/usr/local/flutter
ARG FLUTTER_VERSION=3.19.6
ARG APP=/app/
#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
# setup the flutter path as an enviromental variable
ENV PATH="$FLUTTER_SDK/bin:$FLUTTER_SDK/bin/cache/dart-sdk/bin:${PATH}"
# Start to run Flutter commands
# doctor to see if all was installes ok
RUN flutter doctor -v
# 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
# Run build: 1 - clean, 2 - pub get, 3 - build web
RUN flutter clean
RUN flutter pub get
2024-07-17 13:28:02 +02:00
RUN flutter build web \
2024-11-19 15:06:22 +01:00
--dart-define=AUTH_MODE=$AUTH_MODE \
2024-07-17 13:28:02 +02:00
--dart-define=WORKSPACE_HOST=$WORKSPACE_HOST \
--dart-define=WORKFLOW_HOST=$WORKFLOW_HOST \
2024-10-15 11:28:29 +02:00
--dart-define=PEER_HOST=$PEER_HOST \
--dart-define=COLLABORATIVE_AREA_HOST=$COLLABORATIVE_AREA_HOST \
--dart-define=SCHEDULER_HOST=$SCHEDULER_HOST \
--dart-define=LOGS_HOST=$LOGS_HOST \
2024-11-08 13:59:22 +01:00
--dart-define=ITEM_HOST=$ITEM_HOST \
2024-11-13 08:12:37 +01:00
--dart-define=DATACENTER_HOST=$DATACENTER_HOST
# once heare the app will be compiled and ready to deploy
# use nginx to deploy
FROM nginx:1.25.2-alpine
# 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;"]