0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Flutter WebをAWS Amplify Hostingにデプロイするときのamplify.yml

Last updated at Posted at 2023-09-15

AWS Amplifyではビルド時に走らせるスクリプトを指定することができます。Flutter webをAmplify Hostingにデプロイするときのビルドスクリプトで少し詰まったので、ここに共有しておきます。

amplify.yml
version: 1
frontend:
  phases:
    preBuild:
      commands:
        - |
            if [ ! -d _amplify_flutter_root ]; then
                git clone https://github.com/flutter/flutter.git _amplify_flutter_root
            else
                echo "Flutter is already installed."
            fi
            _amplify_flutter_root/bin/flutter --version
            _amplify_flutter_root/bin/flutter channel stable
            _amplify_flutter_root/bin/flutter upgrade
            _amplify_flutter_root/bin/flutter pub get
    build:
      commands:
        - |
            _amplify_flutter_root/bin/flutter build web
  artifacts:
    baseDirectory: build/web
    files:
      - '**/*'
  cache:
    paths:
      - _amplify_flutter_root

前のキャッシュが残っている時にビルドが失敗するときがありましたが、一旦rm -rf _amplify_flutter_rootをしてキャッシュを消せばそれ以降は安定して動くようになりました。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?