I have been trying to deploy my application on elastic beanstalk but it keeps failing. I tried to to deploy it on AWS ECR + Fargate and GCP Cloud Run and it works without any problem. I have also tried to set it to immutable and still fail.
Here's my Dockerfile
#Stage 1 - Install dependencies and build the app
FROM debian:latest AS build-env
# Install flutter dependencies
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
# Clone the flutter repo
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
# Set flutter path
# RUN /usr/local/flutter/bin/flutter doctor -v
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
# Run flutter doctor
RUN flutter doctor -v
# Enable flutter web
RUN flutter channel master
RUN flutter upgrade
RUN flutter config --enable-web
# Copy files to container and build
RUN mkdir /app/
COPY . /app/
WORKDIR /app/
RUN flutter build web
# Stage 2 - Create the run-time image
FROM nginx:1.21.1-alpine
COPY --from=build-env /app/build/web /usr/share/nginx/html
It crash somewhere around step 7.
Step 7/18 : RUN flutter channel stable
---> Running in af4a4105e884
[91mDownloading Linux x64 Dart SDK from Flutter engine 4e6cbe0fc22d0a7c3f3380dff23ad2cad84b2170...
[0m % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 198M 0 28911 0 0 159k 0 0:21:12 --:--:-- 0:21:12 158k
53 198M 53 106M 0 0 92.3M 0 0:00:02 0:00:01 0:00:01 92.2M
100 198M 100 198M 0 0 107M 0 0:00:01 0:00:01 --:--:-- 107M
[91mBuilding flutter tool...
[0mResolving dependencies...
Got dependencies.
[91m
===== CRASH =====
si_signo=Bus error(7), si_code=2, si_addr=0x7fafc3d69000
version=3.0.0-300.0.dev (dev) (Sat Mar 4 11:55:16 2023 -0800) on "linux_x64"
pid=212, thread=218, isolate_group=kernel-service(0x7fb004035d10), isolate=kernel-service(0x7fb0040144e0)
os=linux, arch=x64, comp=no, sim=no
isolate_instructions=7fb008b5f000, vm_instructions=556d3f931380
fp=7faff5ffd1c0, sp=7faff5ffd178, pc=7fb010d3f733
pc 0x00007fb010d3f733 fp 0x00007faff5ffd1c0 /lib/x86_64-linux-gnu/libc.so.6+0x18b733
===== CRASH =====
si_signo=Bus error(7), si_code=2, si_addr=0x7fafc794f040
Aborting reentrant request for stack trace.
[0m[91m/usr/local/flutter/bin/internal/shared.sh: line 178: 212 Aborted (core dumped) "$DART" --verbosity=error --disable-dart-dev $FLUTTER_TOOL_ARGS --snapshot="$SNAPSHOT_PATH" --snapshot-kind="app-jit" --packages="$FLUTTER_TOOLS_DIR/.dart_tool/package_config.json" --no-enable-mirrors "$SCRIPT_PATH" > /dev/null
[0m
2023/03/07 17:39:54.516708 [INFO] Building app-prod
The command '/bin/sh -c flutter channel stable' returned a non-zero code: 134
2023/03/07 17:39:54.577381 [WARN] failed to execute command: docker-compose build, retrying...
2023/03/07 17:39:54.577428 [INFO] Running command /bin/sh -c docker-compose build
2023/03/07 18:00:11.377269 [INFO] Sending build context to Docker daemon 580.1kB Step 1/18 : FROM ubuntu:20.04 AS builder
Many of my apps like React, NodeJS are running on Elastic Beanstalk. I want my flutter web to run on Elastic Beanstalk as well.