-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (33 loc) · 1.19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Stage 1: Build the Flutter web application
FROM ubuntu:latest AS builder
# Install dependencies
RUN apt-get update && apt-get install -y curl git unzip xz-utils zip libglu1-mesa java-common openjdk-11-jre-headless
# Set up Flutter environment variables
ENV FLUTTER_HOME=/usr/local/flutter
ENV PATH=$FLUTTER_HOME/bin:$FLUTTER_HOME/bin/cache/dart-sdk/bin:$PATH
RUN useradd -ms /bin/bash builder
RUN chown -R builder:builder /usr/local/
USER builder
# Download and install Flutter SDK
RUN git clone https://github.com/flutter/flutter.git $FLUTTER_HOME
RUN flutter doctor
# Copy the Flutter web application code to the container
COPY . /app
WORKDIR /app
USER root
RUN chown -R builder:builder /app
USER builder
# Install dependencies
RUN flutter pub get
# Build API library from openAPI spec
RUN flutter pub run build_runner build --delete-conflicting-outputs
# Build the Flutter web application
RUN flutter build web
# Stage 2: Create the Nginx container
FROM nginx:latest
# Copy the built Flutter web application to the Nginx container
COPY --from=builder /app/build/web /usr/share/nginx/html
# Expose port 80 for the Nginx server
EXPOSE 80
# Start the Nginx server
CMD ["nginx", "-g", "daemon off;"]