├── .github ├── dependabot.yml └── workflows │ ├── check-tags.yml │ ├── docker-image.yml │ ├── generate-library.yml │ ├── gerrit-reviewed.yml │ └── scripts.yml ├── Dockerfile-debian.template ├── LICENSE ├── OWNERS ├── README.md ├── beta └── bookworm │ └── Dockerfile ├── scripts ├── .analysis_options.yaml ├── .gitignore ├── bin │ ├── generate_library.dart │ ├── update.dart │ └── verify.dart ├── lib │ └── src │ │ ├── dockerfile.dart │ │ ├── http.dart │ │ ├── library.dart │ │ └── versions.dart ├── pubspec.lock ├── pubspec.yaml └── test │ ├── dockerfile_test.dart │ ├── library_test.dart │ ├── update_test.dart │ ├── utils.dart │ ├── verify_test.dart │ └── versions_test.dart ├── stable └── bookworm │ └── Dockerfile └── versions.json /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Dependabot configuration file. 2 | # See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates 3 | version: 2 4 | 5 | updates: 6 | - package-ecosystem: "github-actions" 7 | directory: "/" 8 | schedule: 9 | interval: "monthly" 10 | labels: 11 | - type-infra 12 | groups: 13 | github-actions: 14 | patterns: 15 | - "*" 16 | 17 | - package-ecosystem: "pub" 18 | directory: "/scripts" 19 | schedule: 20 | interval: "monthly" 21 | labels: 22 | - type-infra 23 | groups: 24 | pub: 25 | patterns: 26 | - "*" 27 | -------------------------------------------------------------------------------- /.github/workflows/check-tags.yml: -------------------------------------------------------------------------------- 1 | name: Dart Docker Check Tags on DockerHub 2 | 3 | on: 4 | schedule: 5 | - cron: '04 8 * * *' # At 0804 each day 6 | 7 | permissions: 8 | contents: read 9 | 10 | defaults: 11 | run: 12 | shell: "bash -Eeuo pipefail -x {0}" 13 | 14 | jobs: 15 | check-tags: 16 | name: Check Tags 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 20 | with: 21 | sparse-checkout: | 22 | versions.json 23 | sparse-checkout-cone-mode: false 24 | - name: Check Tags on DockerHub 25 | run: | 26 | channels=( stable beta ) 27 | for channel in "${channels[@]}" 28 | do 29 | echo "Testing tags for ${channel} channel" 30 | DART_VERSION=$(cat versions.json | jq -r .${channel}.version) 31 | echo "Looking for Dart version ${DART_VERSION}" 32 | docker buildx imagetools inspect dart:${DART_VERSION} --format \ 33 | "{{json .Manifest}}" > ${channel}_manifest 34 | cat versions.json | jq -r ".${channel}.sha256 | keys | .[]" | \ 35 | sed s/x64/amd64/ | sort > ${channel}_expected 36 | cat ${channel}_manifest | jq -r \ 37 | '[.manifests[].platform.architecture] | sort | .[]' \ 38 | > ${channel}_found 39 | diff ${channel}_expected ${channel}_found 40 | done 41 | -------------------------------------------------------------------------------- /.github/workflows/docker-image.yml: -------------------------------------------------------------------------------- 1 | name: Dart Docker Image CI 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | schedule: 9 | - cron: 0 0 * * 0 10 | 11 | env: 12 | GENERATE_STACKBREW_LIBRARY: scripts/bin/generate_library.dart 13 | 14 | defaults: 15 | run: 16 | shell: "bash -Eeuo pipefail -x {0}" 17 | 18 | jobs: 19 | generate-jobs: 20 | name: Generate Jobs 21 | runs-on: ubuntu-latest 22 | outputs: 23 | strategy: ${{ steps.generate-jobs.outputs.strategy }} 24 | steps: 25 | - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c 26 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 27 | - id: install 28 | name: Install dependencies 29 | run: dart pub get 30 | working-directory: scripts 31 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 32 | with: 33 | path: bashbrew 34 | ref: v0.1.2 35 | repository: docker-library/bashbrew 36 | - id: generate-jobs 37 | name: Generate Jobs 38 | run: | 39 | sed -i 's/image\=.*/image\=dart/' bashbrew/scripts/github-actions/generate.sh 40 | strategy="$(bashbrew/scripts/github-actions/generate.sh)" 41 | jq . <<<"$strategy" # sanity check / debugging aid 42 | echo "strategy=$strategy" >> $GITHUB_OUTPUT 43 | test: 44 | needs: generate-jobs 45 | strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }} 46 | name: ${{ matrix.name }} 47 | runs-on: ${{ matrix.os }} 48 | steps: 49 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 50 | - name: Prepare Environment 51 | run: ${{ matrix.runs.prepare }} 52 | - name: Pull Dependencies 53 | run: ${{ matrix.runs.pull }} 54 | - name: Build ${{ matrix.name }} 55 | run: ${{ matrix.runs.build }} 56 | - name: History ${{ matrix.name }} 57 | run: ${{ matrix.runs.history }} 58 | - name: Test ${{ matrix.name }} 59 | run: ${{ matrix.runs.test }} 60 | - name: '"docker images"' 61 | run: ${{ matrix.runs.images }} 62 | -------------------------------------------------------------------------------- /.github/workflows/generate-library.yml: -------------------------------------------------------------------------------- 1 | name: Generate Library CI 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | schedule: 9 | - cron: 0 0 * * 0 10 | 11 | env: 12 | PUB_ENVIRONMENT: bot.github 13 | 14 | jobs: 15 | generate-library: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 19 | - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c 20 | - id: install 21 | name: Install dependencies 22 | run: dart pub get 23 | working-directory: scripts 24 | - name: Generate library 25 | run: dart scripts/bin/generate_library.dart 26 | -------------------------------------------------------------------------------- /.github/workflows/gerrit-reviewed.yml: -------------------------------------------------------------------------------- 1 | # A workflow to prevent PRs from being submitted through the GitHub UI. 2 | 3 | name: Do Not Submit 4 | 5 | on: 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | do-not-submit: 11 | name: Gerrit reviewed 12 | runs-on: ubuntu-latest 13 | steps: 14 | - run: | 15 | echo "Do not submit this PR through github - this repo uses Gerrit for reviews." 16 | exit 1 17 | -------------------------------------------------------------------------------- /.github/workflows/scripts.yml: -------------------------------------------------------------------------------- 1 | name: Scripts CI 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | paths: 7 | - 'scripts/**' 8 | pull_request: 9 | branches: [ main ] 10 | paths: 11 | - 'scripts/**' 12 | schedule: 13 | - cron: "0 0 * * 0" 14 | 15 | defaults: 16 | run: 17 | working-directory: scripts 18 | 19 | env: 20 | PUB_ENVIRONMENT: bot.github 21 | 22 | jobs: 23 | analyze-and-test: 24 | runs-on: ubuntu-latest 25 | steps: 26 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 27 | - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c 28 | - id: install 29 | name: Install dependencies 30 | run: dart pub get 31 | - name: Check formatting 32 | run: dart format --output=none --set-exit-if-changed . 33 | if: always() && steps.install.outcome == 'success' 34 | - name: Analyze code 35 | run: dart analyze --fatal-infos 36 | if: always() && steps.install.outcome == 'success' 37 | - name: Run VM tests 38 | run: dart test --platform vm 39 | if: always() && steps.install.outcome == 'success' 40 | -------------------------------------------------------------------------------- /Dockerfile-debian.template: -------------------------------------------------------------------------------- 1 | FROM debian:bookworm-slim 2 | 3 | RUN set -eux; \ 4 | apt-get update; \ 5 | apt-get install -y --no-install-recommends \ 6 | ca-certificates \ 7 | curl \ 8 | dnsutils \ 9 | git \ 10 | openssh-client \ 11 | unzip \ 12 | ; \ 13 | rm -rf /var/lib/apt/lists/* 14 | 15 | # Create a minimal runtime environment for executing AOT-compiled Dart code 16 | # with the smallest possible image size. 17 | # usage: COPY --from=dart:xxx /runtime/ / 18 | # uses hard links here to save space 19 | RUN set -eux; \ 20 | case "$(dpkg --print-architecture)" in \ 21 | amd64) \ 22 | TRIPLET="x86_64-linux-gnu" ; \ 23 | FILES="/lib64/ld-linux-x86-64.so.2" ;; \ 24 | armhf) \ 25 | TRIPLET="arm-linux-gnueabihf" ; \ 26 | FILES="/lib/ld-linux-armhf.so.3 \ 27 | /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3";; \ 28 | arm64) \ 29 | TRIPLET="aarch64-linux-gnu" ; \ 30 | FILES="/lib/ld-linux-aarch64.so.1 \ 31 | /lib/aarch64-linux-gnu/ld-linux-aarch64.so.1" ;; \ 32 | *) \ 33 | echo "Unsupported architecture" ; \ 34 | exit 5;; \ 35 | esac; \ 36 | FILES="$FILES \ 37 | /etc/nsswitch.conf \ 38 | /etc/ssl/certs \ 39 | /usr/share/ca-certificates \ 40 | /lib/$TRIPLET/libc.so.6 \ 41 | /lib/$TRIPLET/libdl.so.2 \ 42 | /lib/$TRIPLET/libm.so.6 \ 43 | /lib/$TRIPLET/libnss_dns.so.2 \ 44 | /lib/$TRIPLET/libpthread.so.0 \ 45 | /lib/$TRIPLET/libresolv.so.2 \ 46 | /lib/$TRIPLET/librt.so.1"; \ 47 | for f in $FILES; do \ 48 | dir=$(dirname "$f"); \ 49 | mkdir -p "/runtime$dir"; \ 50 | cp --archive --link --dereference --no-target-directory "$f" "/runtime$f"; \ 51 | done 52 | 53 | ENV DART_SDK /usr/lib/dart 54 | ENV PATH $DART_SDK/bin:/root/.pub-cache/bin:$PATH 55 | 56 | WORKDIR /root 57 | RUN set -eux; \ 58 | case "$(dpkg --print-architecture)" in \ 59 | amd64) \ 60 | DART_SHA256={{DART_SHA256_X64}}; \ 61 | SDK_ARCH="x64";; \ 62 | armhf) \ 63 | DART_SHA256={{DART_SHA256_ARM}}; \ 64 | SDK_ARCH="arm";; \ 65 | arm64) \ 66 | DART_SHA256={{DART_SHA256_ARM64}}; \ 67 | SDK_ARCH="arm64";; \ 68 | esac; \ 69 | SDK="dartsdk-linux-${SDK_ARCH}-release.zip"; \ 70 | BASEURL="https://storage.googleapis.com/dart-archive/channels"; \ 71 | URL="$BASEURL/{{DART_CHANNEL}}/release/{{DART_VERSION}}/sdk/$SDK"; \ 72 | echo "SDK: $URL" >> dart_setup.log ; \ 73 | curl -fLO "$URL"; \ 74 | echo "$DART_SHA256 *$SDK" \ 75 | | sha256sum --check --status --strict -; \ 76 | unzip "$SDK" && mv dart-sdk "$DART_SDK" && rm "$SDK" \ 77 | && chmod 755 "$DART_SDK" && chmod 755 "$DART_SDK/bin"; 78 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2021, the Dart project authors. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer in the documentation and/or other materials provided 12 | with the distribution. 13 | * Neither the name of Google LLC nor the names of its 14 | contributors may be used to endorse or promote products derived 15 | from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | athom@google.com 2 | jonasfj@google.com 3 | kevinjchisholm@google.com 4 | iinozemtsev@google.com 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dart-docker 2 | 3 | This is the Git repo of the [Docker "Official Images"] for the 4 | [Dart programming language][dart]. 5 | 6 | See the [Docker Hub page] for a full description on how to use these Docker 7 | images as well as for information regarding contributing and issues. 8 | 9 | The [Docker Hub page] is generated/maintained over in the 10 | [docker-library/docs repository], specifically in [the `dart` directory]. 11 | 12 | 13 | Maintained with ❤️ by the [Dart] team. 14 | 15 | 16 | 17 | 18 | [dart]: 19 | https://dart.dev 20 | 21 | [docker hub page]: 22 | https://hub.docker.com/_/dart/ 23 | 24 | [docker-library/docs repository]: 25 | https://github.com/docker-library/docs 26 | 27 | [docker "official images"]: 28 | https://github.com/docker-library/official-images#what-are-official-images 29 | 30 | [the `dart` directory]: 31 | https://github.com/docker-library/docs/tree/master/dart 32 | -------------------------------------------------------------------------------- /beta/bookworm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bookworm-slim 2 | 3 | RUN set -eux; \ 4 | apt-get update; \ 5 | apt-get install -y --no-install-recommends \ 6 | ca-certificates \ 7 | curl \ 8 | dnsutils \ 9 | git \ 10 | openssh-client \ 11 | unzip \ 12 | ; \ 13 | rm -rf /var/lib/apt/lists/* 14 | 15 | # Create a minimal runtime environment for executing AOT-compiled Dart code 16 | # with the smallest possible image size. 17 | # usage: COPY --from=dart:xxx /runtime/ / 18 | # uses hard links here to save space 19 | RUN set -eux; \ 20 | case "$(dpkg --print-architecture)" in \ 21 | amd64) \ 22 | TRIPLET="x86_64-linux-gnu" ; \ 23 | FILES="/lib64/ld-linux-x86-64.so.2" ;; \ 24 | armhf) \ 25 | TRIPLET="arm-linux-gnueabihf" ; \ 26 | FILES="/lib/ld-linux-armhf.so.3 \ 27 | /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3";; \ 28 | arm64) \ 29 | TRIPLET="aarch64-linux-gnu" ; \ 30 | FILES="/lib/ld-linux-aarch64.so.1 \ 31 | /lib/aarch64-linux-gnu/ld-linux-aarch64.so.1" ;; \ 32 | *) \ 33 | echo "Unsupported architecture" ; \ 34 | exit 5;; \ 35 | esac; \ 36 | FILES="$FILES \ 37 | /etc/nsswitch.conf \ 38 | /etc/ssl/certs \ 39 | /usr/share/ca-certificates \ 40 | /lib/$TRIPLET/libc.so.6 \ 41 | /lib/$TRIPLET/libdl.so.2 \ 42 | /lib/$TRIPLET/libm.so.6 \ 43 | /lib/$TRIPLET/libnss_dns.so.2 \ 44 | /lib/$TRIPLET/libpthread.so.0 \ 45 | /lib/$TRIPLET/libresolv.so.2 \ 46 | /lib/$TRIPLET/librt.so.1"; \ 47 | for f in $FILES; do \ 48 | dir=$(dirname "$f"); \ 49 | mkdir -p "/runtime$dir"; \ 50 | cp --archive --link --dereference --no-target-directory "$f" "/runtime$f"; \ 51 | done 52 | 53 | ENV DART_SDK /usr/lib/dart 54 | ENV PATH $DART_SDK/bin:/root/.pub-cache/bin:$PATH 55 | 56 | WORKDIR /root 57 | RUN set -eux; \ 58 | case "$(dpkg --print-architecture)" in \ 59 | amd64) \ 60 | DART_SHA256=d97e026a18428748fc3b4fd7762a6e6b03c44954ba5245d7ebef448832ad3efc; \ 61 | SDK_ARCH="x64";; \ 62 | armhf) \ 63 | DART_SHA256=51522ceae050f3d6aeedd6a3702992daa34d8aca6e316ef8c33e46e3a3656ea6; \ 64 | SDK_ARCH="arm";; \ 65 | arm64) \ 66 | DART_SHA256=e60b9ffd7b5fe2bbc8ee35c492521ba6bc07c94bac64ae7199ca77df737d61a3; \ 67 | SDK_ARCH="arm64";; \ 68 | esac; \ 69 | SDK="dartsdk-linux-${SDK_ARCH}-release.zip"; \ 70 | BASEURL="https://storage.googleapis.com/dart-archive/channels"; \ 71 | URL="$BASEURL/beta/release/3.9.0-196.1.beta/sdk/$SDK"; \ 72 | echo "SDK: $URL" >> dart_setup.log ; \ 73 | curl -fLO "$URL"; \ 74 | echo "$DART_SHA256 *$SDK" \ 75 | | sha256sum --check --status --strict -; \ 76 | unzip "$SDK" && mv dart-sdk "$DART_SDK" && rm "$SDK" \ 77 | && chmod 755 "$DART_SDK" && chmod 755 "$DART_SDK/bin"; 78 | -------------------------------------------------------------------------------- /scripts/.analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:dart_flutter_team_lints/analysis_options.yaml 2 | -------------------------------------------------------------------------------- /scripts/.gitignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub. 2 | .dart_tool/ 3 | 4 | # Conventional directory for build output. 5 | build/ 6 | -------------------------------------------------------------------------------- /scripts/bin/generate_library.dart: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env dart 2 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 3 | // for details. All rights reserved. Use of this source code is governed by a 4 | // BSD-style license that can be found in the LICENSE file. 5 | 6 | import 'dart:io'; 7 | 8 | import 'package:file/file.dart'; 9 | import 'package:file/local.dart'; 10 | import 'package:scripts/src/library.dart'; 11 | import 'package:scripts/src/versions.dart'; 12 | 13 | /// Reads `versions.json` and generates the `dart` library definition. 14 | void main() { 15 | generateLibrary(const LocalFileSystem()); 16 | } 17 | 18 | void generateLibrary(FileSystem fileSystem) { 19 | var read = (_, {headers}) => 20 | throw StateError("generate_library should work offline"); 21 | var versions = versionsFromFile(fileSystem, read); 22 | stdout.write(buildLibrary(commit, versions['stable']!, versions['beta']!)); 23 | } 24 | -------------------------------------------------------------------------------- /scripts/bin/update.dart: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env dart 2 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 3 | // for details. All rights reserved. Use of this source code is governed by a 4 | // BSD-style license that can be found in the LICENSE file. 5 | 6 | import 'package:args/args.dart'; 7 | import 'package:file/file.dart'; 8 | import 'package:file/local.dart'; 9 | import 'package:scripts/src/dockerfile.dart'; 10 | import 'package:scripts/src/http.dart' as http; 11 | import 'package:scripts/src/versions.dart'; 12 | 13 | /// Downloads the latest versions on the Dart stable and beta channels and the 14 | /// relevant SHA256 checksums. For all versions that haven't changed, the script 15 | /// verifies that the checksums are still matching. 16 | void main(List args) async { 17 | final results = (ArgParser()..addFlag('force', abbr: 'f')).parse(args); 18 | final force = results['force']; 19 | await update(const LocalFileSystem(), http.read, force); 20 | } 21 | 22 | Future update( 23 | FileSystem fileSystem, 24 | http.HttpRead read, 25 | bool force, 26 | ) async { 27 | final versions = versionsFromFile(fileSystem, read); 28 | final updated = {}; 29 | await for (final version in Stream.fromIterable(versions.values)) { 30 | if (await version.update() || force) { 31 | updated.add(version); 32 | } 33 | } 34 | if (force || updated.isNotEmpty) { 35 | final template = fileSystem 36 | .file('Dockerfile-debian.template') 37 | .readAsStringSync(); 38 | writeVersionsFile(fileSystem, [versions['stable']!, versions['beta']!]); 39 | for (final version in updated) { 40 | final dockerfileContent = buildDockerfile(version, template); 41 | final dockerfile = 42 | (await fileSystem 43 | .directory('${version.channel}/bookworm') 44 | .create(recursive: true)) 45 | .childFile('Dockerfile'); 46 | await dockerfile.writeAsString(dockerfileContent); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /scripts/bin/verify.dart: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env dart 2 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 3 | // for details. All rights reserved. Use of this source code is governed by a 4 | // BSD-style license that can be found in the LICENSE file. 5 | 6 | import 'package:file/file.dart'; 7 | import 'package:file/local.dart'; 8 | import 'package:scripts/src/http.dart' as http; 9 | import 'package:scripts/src/versions.dart'; 10 | 11 | /// Downloads the latest versions on the Dart stable and beta channels and the 12 | /// relevant SHA256 checksums. For all versions that haven't changed, the script 13 | /// verifies that the checksums are still matching. 14 | void main() async { 15 | await verify(const LocalFileSystem(), http.read); 16 | } 17 | 18 | Future verify(FileSystem fileSystem, http.HttpRead read) async { 19 | var versions = versionsFromFile(fileSystem, read); 20 | await for (var version in Stream.fromIterable(versions.values)) { 21 | await version.verify(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /scripts/lib/src/dockerfile.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:scripts/src/versions.dart'; 6 | 7 | /// Generate the `Dockerfile` for the [version] using a [template]. 8 | String buildDockerfile(DartSdkVersion version, String template) { 9 | var variables = { 10 | 'DART_CHANNEL': version.channel, 11 | 'DART_VERSION': version.version.toString(), 12 | 'DART_SHA256_X64': version.sha256['x64'], 13 | 'DART_SHA256_ARM': version.sha256['arm'], 14 | 'DART_SHA256_ARM64': version.sha256['arm64'], 15 | }; 16 | var dockerfile = template.splitMapJoin( 17 | RegExp(r'{{(.*?)}}'), 18 | onMatch: (match) { 19 | var value = variables.remove(match[1]!); 20 | if (value == null) { 21 | throw StateError('Unknown template variable ${match[1]}'); 22 | } 23 | return value; 24 | }, 25 | ); 26 | if (variables.isNotEmpty) { 27 | throw ArgumentError.value(template, 'template', 'missing $variables'); 28 | } 29 | return dockerfile; 30 | } 31 | -------------------------------------------------------------------------------- /scripts/lib/src/http.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:http/http.dart'; 6 | import 'package:http/retry.dart'; 7 | 8 | typedef HttpRead = 9 | Future Function(Uri url, {Map? headers}); 10 | 11 | Future read(Uri url, {Map? headers}) async { 12 | final client = RetryClient(Client()); 13 | try { 14 | return await client.read(url, headers: headers); 15 | } finally { 16 | client.close(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /scripts/lib/src/library.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'dart:io'; 6 | 7 | import 'package:scripts/src/versions.dart'; 8 | 9 | /// Builds a library file for the official images repository based on the passed 10 | /// [commit] and [versions]. 11 | String buildLibrary(String commit, DartSdkVersion stable, DartSdkVersion beta) { 12 | var library = StringBuffer(''' 13 | Maintainers: Alexander Thomas (@athomas), Ivan Inozemtsev (@iinozemtsev) 14 | GitRepo: https://github.com/dart-lang/dart-docker.git 15 | GitFetch: refs/heads/main 16 | GitCommit: $commit 17 | '''); 18 | if (stable.version >= beta.version) { 19 | // stable is ahead of beta, that means stable _is_ beta. 20 | var tags = stable.tags.followedBy(['beta-sdk', 'beta']); 21 | library.write(_imageData(tags, 'stable')); 22 | } else { 23 | library.write(_imageData(stable.tags, 'stable')); 24 | library.write(_imageData(beta.tags, 'beta')); 25 | } 26 | return library.toString(); 27 | } 28 | 29 | String _imageData(Iterable tags, String channel) => 30 | ''' 31 | 32 | Tags: ${tags.join(', ')} 33 | Architectures: amd64, arm32v7, arm64v8 34 | Directory: $channel/bookworm 35 | '''; 36 | 37 | /// Uses `git rev-parse HEAD` to get the hash of the current commit. 38 | String get commit => 39 | Process.runSync('git', ['rev-parse', 'HEAD']).stdout.trim(); 40 | -------------------------------------------------------------------------------- /scripts/lib/src/versions.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'dart:convert'; 6 | 7 | import 'package:collection/collection.dart'; 8 | import 'package:file/file.dart'; 9 | import 'package:pub_semver/pub_semver.dart'; 10 | 11 | import 'http.dart'; 12 | 13 | Map versionsFromFile( 14 | FileSystem fileSystem, 15 | HttpRead read, 16 | ) { 17 | var json = jsonDecode(fileSystem.file('versions.json').readAsStringSync()); 18 | return versionsFromJson(json, read); 19 | } 20 | 21 | Map versionsFromJson( 22 | Map json, 23 | HttpRead read, 24 | ) { 25 | var stable = DartSdkVersion.fromJson('stable', json['stable']!, read); 26 | var beta = DartSdkVersion.fromJson('beta', json['beta']!, read); 27 | return {'stable': stable, 'beta': beta}; 28 | } 29 | 30 | void writeVersionsFile(FileSystem fileSystem, List versions) { 31 | fileSystem 32 | .file('versions.json') 33 | .writeAsStringSync( 34 | JsonEncoder.withIndent(' ').convert({ 35 | for (var version in versions) 36 | version.channel: { 37 | 'version': version.version.toString(), 38 | 'sha256': version.sha256, 39 | }, 40 | }), 41 | ); 42 | } 43 | 44 | class DartSdkVersion { 45 | static final baseUri = Uri.https( 46 | 'storage.googleapis.com', 47 | 'dart-archive/channels/', 48 | ); 49 | 50 | final String channel; 51 | Version version; 52 | Map sha256; 53 | final HttpRead _read; 54 | 55 | DartSdkVersion(this.channel, this.version, this.sha256, this._read); 56 | 57 | factory DartSdkVersion.fromJson( 58 | String channel, 59 | Map json, 60 | HttpRead read, 61 | ) { 62 | var version = Version.parse(json['version']!); 63 | var sha256 = (json['sha256']! as Map).cast(); 64 | return DartSdkVersion(channel, version, sha256, read); 65 | } 66 | 67 | Iterable get tags { 68 | if (channel == 'stable') { 69 | var major = version.major; 70 | var minor = version.minor; 71 | return [ 72 | '$version-sdk', 73 | '$major.$minor-sdk', 74 | '$major-sdk', 75 | 'stable-sdk', 76 | 'sdk', 77 | '$version', 78 | '$major.$minor', 79 | '$major', 80 | 'stable', 81 | 'latest', 82 | ]; 83 | } 84 | if (channel == 'beta') { 85 | return ['$version-sdk', 'beta-sdk', '$version', 'beta']; 86 | } 87 | throw StateError("Unsupported channel '$channel'"); 88 | } 89 | 90 | @override 91 | String toString() { 92 | return '$version $channel $sha256'; 93 | } 94 | 95 | Future verify() async { 96 | var remoteSha256 = await _readSha256(version); 97 | if (!MapEquality().equals(sha256, remoteSha256)) { 98 | throw StateError("Expected SHA256 '$sha256' but got '$remoteSha256'"); 99 | } 100 | } 101 | 102 | Future update() async { 103 | var latest = await _readLatestVersion(); 104 | if (version == latest) { 105 | return false; 106 | } 107 | sha256 = await _readSha256(latest); 108 | version = latest; 109 | return true; 110 | } 111 | 112 | Future> _readSha256(Version version) async { 113 | var sha256 = {}; 114 | for (var arch in ['x64', 'arm', 'arm64']) { 115 | var sdk = 'dartsdk-linux-$arch-release.zip'; 116 | var sha256Url = baseUri.resolve( 117 | '$channel/release/$version/sdk/$sdk.sha256sum', 118 | ); 119 | var sha256sum = await _read(sha256Url); 120 | if (!sha256sum.trim().endsWith(sdk)) { 121 | throw StateError("Expected file name $sdk in sha256sum:\n$sha256sum"); 122 | } 123 | sha256[arch] = sha256sum.split(' ').first; 124 | } 125 | return sha256; 126 | } 127 | 128 | Future _readLatestVersion() async { 129 | var versionUrl = baseUri.resolve('$channel/release/latest/VERSION'); 130 | var versionJson = jsonDecode(await _read(versionUrl)); 131 | return Version.parse(versionJson['version']); 132 | } 133 | 134 | bool operator ==(Object other) { 135 | return other is DartSdkVersion && 136 | other.channel == channel && 137 | other.version == version && 138 | MapEquality().equals(other.sha256, sha256); 139 | } 140 | 141 | @override 142 | int get hashCode { 143 | return channel.hashCode ^ version.hashCode ^ MapEquality().hash(sha256); 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /scripts/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | sha256: e55636ed79578b9abca5fecf9437947798f5ef7456308b5cb85720b793eac92f 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "82.0.0" 12 | analyzer: 13 | dependency: transitive 14 | description: 15 | name: analyzer 16 | sha256: "904ae5bb474d32c38fb9482e2d925d5454cda04ddd0e55d2e6826bc72f6ba8c0" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "7.4.5" 20 | args: 21 | dependency: "direct main" 22 | description: 23 | name: args 24 | sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "2.7.0" 28 | async: 29 | dependency: transitive 30 | description: 31 | name: async 32 | sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "2.13.0" 36 | boolean_selector: 37 | dependency: transitive 38 | description: 39 | name: boolean_selector 40 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "2.1.2" 44 | checked_yaml: 45 | dependency: transitive 46 | description: 47 | name: checked_yaml 48 | sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "2.0.3" 52 | cli_config: 53 | dependency: transitive 54 | description: 55 | name: cli_config 56 | sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec 57 | url: "https://pub.dev" 58 | source: hosted 59 | version: "0.2.0" 60 | collection: 61 | dependency: "direct main" 62 | description: 63 | name: collection 64 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 65 | url: "https://pub.dev" 66 | source: hosted 67 | version: "1.19.1" 68 | convert: 69 | dependency: transitive 70 | description: 71 | name: convert 72 | sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 73 | url: "https://pub.dev" 74 | source: hosted 75 | version: "3.1.2" 76 | coverage: 77 | dependency: transitive 78 | description: 79 | name: coverage 80 | sha256: "4b8701e48a58f7712492c9b1f7ba0bb9d525644dd66d023b62e1fc8cdb560c8a" 81 | url: "https://pub.dev" 82 | source: hosted 83 | version: "1.14.0" 84 | crypto: 85 | dependency: transitive 86 | description: 87 | name: crypto 88 | sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" 89 | url: "https://pub.dev" 90 | source: hosted 91 | version: "3.0.6" 92 | dart_flutter_team_lints: 93 | dependency: "direct dev" 94 | description: 95 | name: dart_flutter_team_lints 96 | sha256: ce0f23e2cf95cbd21766d17a7cf88584758b67fd77338d61f2ce77e3cf6d763c 97 | url: "https://pub.dev" 98 | source: hosted 99 | version: "3.5.2" 100 | file: 101 | dependency: "direct main" 102 | description: 103 | name: file 104 | sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 105 | url: "https://pub.dev" 106 | source: hosted 107 | version: "7.0.1" 108 | frontend_server_client: 109 | dependency: transitive 110 | description: 111 | name: frontend_server_client 112 | sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 113 | url: "https://pub.dev" 114 | source: hosted 115 | version: "4.0.0" 116 | glob: 117 | dependency: transitive 118 | description: 119 | name: glob 120 | sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de 121 | url: "https://pub.dev" 122 | source: hosted 123 | version: "2.1.3" 124 | http: 125 | dependency: "direct main" 126 | description: 127 | name: http 128 | sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" 129 | url: "https://pub.dev" 130 | source: hosted 131 | version: "1.4.0" 132 | http_multi_server: 133 | dependency: transitive 134 | description: 135 | name: http_multi_server 136 | sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 137 | url: "https://pub.dev" 138 | source: hosted 139 | version: "3.2.2" 140 | http_parser: 141 | dependency: transitive 142 | description: 143 | name: http_parser 144 | sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" 145 | url: "https://pub.dev" 146 | source: hosted 147 | version: "4.1.2" 148 | io: 149 | dependency: transitive 150 | description: 151 | name: io 152 | sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b 153 | url: "https://pub.dev" 154 | source: hosted 155 | version: "1.0.5" 156 | js: 157 | dependency: transitive 158 | description: 159 | name: js 160 | sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" 161 | url: "https://pub.dev" 162 | source: hosted 163 | version: "0.7.2" 164 | json_annotation: 165 | dependency: transitive 166 | description: 167 | name: json_annotation 168 | sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" 169 | url: "https://pub.dev" 170 | source: hosted 171 | version: "4.9.0" 172 | lints: 173 | dependency: transitive 174 | description: 175 | name: lints 176 | sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0 177 | url: "https://pub.dev" 178 | source: hosted 179 | version: "6.0.0" 180 | logging: 181 | dependency: transitive 182 | description: 183 | name: logging 184 | sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 185 | url: "https://pub.dev" 186 | source: hosted 187 | version: "1.3.0" 188 | matcher: 189 | dependency: transitive 190 | description: 191 | name: matcher 192 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 193 | url: "https://pub.dev" 194 | source: hosted 195 | version: "0.12.17" 196 | meta: 197 | dependency: transitive 198 | description: 199 | name: meta 200 | sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" 201 | url: "https://pub.dev" 202 | source: hosted 203 | version: "1.17.0" 204 | mime: 205 | dependency: transitive 206 | description: 207 | name: mime 208 | sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" 209 | url: "https://pub.dev" 210 | source: hosted 211 | version: "2.0.0" 212 | node_preamble: 213 | dependency: transitive 214 | description: 215 | name: node_preamble 216 | sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" 217 | url: "https://pub.dev" 218 | source: hosted 219 | version: "2.0.2" 220 | package_config: 221 | dependency: transitive 222 | description: 223 | name: package_config 224 | sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc 225 | url: "https://pub.dev" 226 | source: hosted 227 | version: "2.2.0" 228 | path: 229 | dependency: transitive 230 | description: 231 | name: path 232 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 233 | url: "https://pub.dev" 234 | source: hosted 235 | version: "1.9.1" 236 | pool: 237 | dependency: transitive 238 | description: 239 | name: pool 240 | sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" 241 | url: "https://pub.dev" 242 | source: hosted 243 | version: "1.5.1" 244 | pub_semver: 245 | dependency: "direct main" 246 | description: 247 | name: pub_semver 248 | sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" 249 | url: "https://pub.dev" 250 | source: hosted 251 | version: "2.2.0" 252 | pubspec_parse: 253 | dependency: transitive 254 | description: 255 | name: pubspec_parse 256 | sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" 257 | url: "https://pub.dev" 258 | source: hosted 259 | version: "1.5.0" 260 | shelf: 261 | dependency: transitive 262 | description: 263 | name: shelf 264 | sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 265 | url: "https://pub.dev" 266 | source: hosted 267 | version: "1.4.2" 268 | shelf_packages_handler: 269 | dependency: transitive 270 | description: 271 | name: shelf_packages_handler 272 | sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" 273 | url: "https://pub.dev" 274 | source: hosted 275 | version: "3.0.2" 276 | shelf_static: 277 | dependency: transitive 278 | description: 279 | name: shelf_static 280 | sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 281 | url: "https://pub.dev" 282 | source: hosted 283 | version: "1.1.3" 284 | shelf_web_socket: 285 | dependency: transitive 286 | description: 287 | name: shelf_web_socket 288 | sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" 289 | url: "https://pub.dev" 290 | source: hosted 291 | version: "3.0.0" 292 | source_map_stack_trace: 293 | dependency: transitive 294 | description: 295 | name: source_map_stack_trace 296 | sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b 297 | url: "https://pub.dev" 298 | source: hosted 299 | version: "2.1.2" 300 | source_maps: 301 | dependency: transitive 302 | description: 303 | name: source_maps 304 | sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" 305 | url: "https://pub.dev" 306 | source: hosted 307 | version: "0.10.13" 308 | source_span: 309 | dependency: transitive 310 | description: 311 | name: source_span 312 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 313 | url: "https://pub.dev" 314 | source: hosted 315 | version: "1.10.1" 316 | stack_trace: 317 | dependency: transitive 318 | description: 319 | name: stack_trace 320 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 321 | url: "https://pub.dev" 322 | source: hosted 323 | version: "1.12.1" 324 | stream_channel: 325 | dependency: transitive 326 | description: 327 | name: stream_channel 328 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 329 | url: "https://pub.dev" 330 | source: hosted 331 | version: "2.1.4" 332 | string_scanner: 333 | dependency: transitive 334 | description: 335 | name: string_scanner 336 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 337 | url: "https://pub.dev" 338 | source: hosted 339 | version: "1.4.1" 340 | term_glyph: 341 | dependency: transitive 342 | description: 343 | name: term_glyph 344 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 345 | url: "https://pub.dev" 346 | source: hosted 347 | version: "1.2.2" 348 | test: 349 | dependency: "direct dev" 350 | description: 351 | name: test 352 | sha256: "65e29d831719be0591f7b3b1a32a3cda258ec98c58c7b25f7b84241bc31215bb" 353 | url: "https://pub.dev" 354 | source: hosted 355 | version: "1.26.2" 356 | test_api: 357 | dependency: transitive 358 | description: 359 | name: test_api 360 | sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" 361 | url: "https://pub.dev" 362 | source: hosted 363 | version: "0.7.6" 364 | test_core: 365 | dependency: transitive 366 | description: 367 | name: test_core 368 | sha256: "80bf5a02b60af04b09e14f6fe68b921aad119493e26e490deaca5993fef1b05a" 369 | url: "https://pub.dev" 370 | source: hosted 371 | version: "0.6.11" 372 | typed_data: 373 | dependency: transitive 374 | description: 375 | name: typed_data 376 | sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 377 | url: "https://pub.dev" 378 | source: hosted 379 | version: "1.4.0" 380 | vm_service: 381 | dependency: transitive 382 | description: 383 | name: vm_service 384 | sha256: "6f82e9ee8e7339f5d8b699317f6f3afc17c80a68ebef1bc0d6f52a678c14b1e6" 385 | url: "https://pub.dev" 386 | source: hosted 387 | version: "15.0.1" 388 | watcher: 389 | dependency: transitive 390 | description: 391 | name: watcher 392 | sha256: "69da27e49efa56a15f8afe8f4438c4ec02eff0a117df1b22ea4aad194fe1c104" 393 | url: "https://pub.dev" 394 | source: hosted 395 | version: "1.1.1" 396 | web: 397 | dependency: transitive 398 | description: 399 | name: web 400 | sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" 401 | url: "https://pub.dev" 402 | source: hosted 403 | version: "1.1.1" 404 | web_socket: 405 | dependency: transitive 406 | description: 407 | name: web_socket 408 | sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" 409 | url: "https://pub.dev" 410 | source: hosted 411 | version: "1.0.1" 412 | web_socket_channel: 413 | dependency: transitive 414 | description: 415 | name: web_socket_channel 416 | sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 417 | url: "https://pub.dev" 418 | source: hosted 419 | version: "3.0.3" 420 | webkit_inspection_protocol: 421 | dependency: transitive 422 | description: 423 | name: webkit_inspection_protocol 424 | sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" 425 | url: "https://pub.dev" 426 | source: hosted 427 | version: "1.2.1" 428 | yaml: 429 | dependency: transitive 430 | description: 431 | name: yaml 432 | sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce 433 | url: "https://pub.dev" 434 | source: hosted 435 | version: "3.1.3" 436 | sdks: 437 | dart: ">=3.8.0 <4.0.0" 438 | -------------------------------------------------------------------------------- /scripts/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: scripts 2 | description: Scripts that support the creation of Dart's docker images. 3 | version: 0.0.1 4 | publish_to: none 5 | environment: 6 | sdk: ^3.8.0 7 | 8 | dependencies: 9 | args: ^2.7.0 10 | collection: ^1.19.1 11 | file: ^7.0.1 12 | http: ^1.4.0 13 | pub_semver: ^2.2.0 14 | 15 | dev_dependencies: 16 | dart_flutter_team_lints: ^3.5.1 17 | test: ^1.26.2 18 | -------------------------------------------------------------------------------- /scripts/test/dockerfile_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:pub_semver/pub_semver.dart'; 6 | import 'package:scripts/src/dockerfile.dart'; 7 | import 'package:scripts/src/versions.dart'; 8 | import 'package:test/test.dart'; 9 | 10 | import 'utils.dart'; 11 | 12 | var version = DartSdkVersion('stable', Version.parse('3.14.1'), { 13 | 'x64': 'abc', 14 | 'arm': 'def', 15 | 'arm64': 'ghi', 16 | }, fakeRead); 17 | 18 | void main() { 19 | test('build dockerfile', () { 20 | const expected = ''' 21 | ENV DART_CHANNEL stable 22 | ENV DART_VERSION 3.14.1 23 | ENV DART_SHA256_X64 abc 24 | ENV DART_SHA256_ARM def 25 | ENV DART_SHA256_ARM64 ghi 26 | '''; 27 | var dockerfile = buildDockerfile(version, dockerfileTemplate); 28 | expect(dockerfile, expected); 29 | }); 30 | 31 | test('throws on unknown variable', () { 32 | const template = ''' 33 | ENV UNKNOWN {{UNKNOWN}} 34 | '''; 35 | expect(() => buildDockerfile(version, template), throwsStateError); 36 | }); 37 | 38 | test('throws on missing variable', () { 39 | const template = 'ENV DART_VERSION {{DART_VERSION}}'; 40 | expect(() => buildDockerfile(version, template), throwsArgumentError); 41 | }); 42 | } 43 | -------------------------------------------------------------------------------- /scripts/test/library_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:pub_semver/pub_semver.dart'; 6 | import 'package:scripts/src/versions.dart'; 7 | import 'package:test/test.dart'; 8 | import 'package:scripts/src/library.dart'; 9 | 10 | import 'utils.dart'; 11 | 12 | void main() { 13 | test('build library', () { 14 | var stable = DartSdkVersion( 15 | 'stable', 16 | Version.parse("2.12.4"), 17 | {}, 18 | fakeRead, 19 | ); 20 | var beta = DartSdkVersion( 21 | 'beta', 22 | Version.parse('2.13.0-211.6.beta'), 23 | {}, 24 | fakeRead, 25 | ); 26 | var library = buildLibrary('abcdef', stable, beta); 27 | var expected = ''' 28 | Maintainers: Alexander Thomas (@athomas), Ivan Inozemtsev (@iinozemtsev) 29 | GitRepo: https://github.com/dart-lang/dart-docker.git 30 | GitFetch: refs/heads/main 31 | GitCommit: abcdef 32 | 33 | Tags: 2.12.4-sdk, 2.12-sdk, 2-sdk, stable-sdk, sdk, 2.12.4, 2.12, 2, stable, latest 34 | Architectures: amd64, arm32v7, arm64v8 35 | Directory: stable/bookworm 36 | 37 | Tags: 2.13.0-211.6.beta-sdk, beta-sdk, 2.13.0-211.6.beta, beta 38 | Architectures: amd64, arm32v7, arm64v8 39 | Directory: beta/bookworm 40 | '''; 41 | 42 | expect(library, expected); 43 | }); 44 | 45 | test('build library: stable is beta', () { 46 | var stable = DartSdkVersion( 47 | 'stable', 48 | Version.parse('2.13.0'), 49 | {}, 50 | fakeRead, 51 | ); 52 | var beta = DartSdkVersion('beta', Version.parse('2.13.0'), {}, fakeRead); 53 | var library = buildLibrary('abcdef', stable, beta); 54 | var expected = ''' 55 | Maintainers: Alexander Thomas (@athomas), Ivan Inozemtsev (@iinozemtsev) 56 | GitRepo: https://github.com/dart-lang/dart-docker.git 57 | GitFetch: refs/heads/main 58 | GitCommit: abcdef 59 | 60 | Tags: 2.13.0-sdk, 2.13-sdk, 2-sdk, stable-sdk, sdk, 2.13.0, 2.13, 2, stable, latest, beta-sdk, beta 61 | Architectures: amd64, arm32v7, arm64v8 62 | Directory: stable/bookworm 63 | '''; 64 | 65 | expect(library, expected); 66 | }); 67 | 68 | test('build library: stable is ahead of beta', () { 69 | var stable = DartSdkVersion( 70 | 'stable', 71 | Version.parse('2.13.0'), 72 | {}, 73 | fakeRead, 74 | ); 75 | var beta = DartSdkVersion( 76 | 'beta', 77 | Version.parse('2.13.0-211.6.beta'), 78 | {}, 79 | fakeRead, 80 | ); 81 | var library = buildLibrary('abcdef', stable, beta); 82 | var expected = ''' 83 | Maintainers: Alexander Thomas (@athomas), Ivan Inozemtsev (@iinozemtsev) 84 | GitRepo: https://github.com/dart-lang/dart-docker.git 85 | GitFetch: refs/heads/main 86 | GitCommit: abcdef 87 | 88 | Tags: 2.13.0-sdk, 2.13-sdk, 2-sdk, stable-sdk, sdk, 2.13.0, 2.13, 2, stable, latest, beta-sdk, beta 89 | Architectures: amd64, arm32v7, arm64v8 90 | Directory: stable/bookworm 91 | '''; 92 | 93 | expect(library, expected); 94 | }); 95 | 96 | test('get commit test', () { 97 | expect(commit, matches(r'^\b[0-9a-f]{5,40}\b$')); 98 | }); 99 | } 100 | -------------------------------------------------------------------------------- /scripts/test/update_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:file/memory.dart'; 6 | import 'package:test/test.dart'; 7 | 8 | import '../bin/update.dart' as update; 9 | import 'utils.dart'; 10 | 11 | void main() { 12 | test('update succeeds, no updates', () async { 13 | var read = mockRead({ 14 | '/dart-archive/channels/stable/release/latest/VERSION': 15 | '{"version":"2.12.4"}', 16 | '/dart-archive/channels/beta/release/latest/VERSION': 17 | '{"version":"2.13.0-211.14.beta"}', 18 | }); 19 | 20 | var fileSystem = TestFileSystem.build({'versions.json': versions}); 21 | await update.update(fileSystem.fileSystem, read, false); 22 | 23 | expect(fileSystem.contexts, ['versions.json']); 24 | expect(fileSystem.operations, [FileSystemOp.read]); 25 | }); 26 | 27 | test('update succeeds, dockerfile updated', () async { 28 | var read = mockRead({ 29 | '/dart-archive/channels/stable/release/latest/VERSION': 30 | '{"version":"2.12.4"}', 31 | '/dart-archive/channels/beta/release/latest/VERSION': 32 | '{"version":"2.14.0-16.1.beta"}', 33 | '/dart-archive/channels/beta/release/2.14.0-16.1.beta/sdk/dartsdk-linux-x64-release.zip.sha256sum': 34 | 'x64-sha *dartsdk-linux-x64-release.zip', 35 | '/dart-archive/channels/beta/release/2.14.0-16.1.beta/sdk/dartsdk-linux-arm-release.zip.sha256sum': 36 | 'arm-sha *dartsdk-linux-arm-release.zip', 37 | '/dart-archive/channels/beta/release/2.14.0-16.1.beta/sdk/dartsdk-linux-arm64-release.zip.sha256sum': 38 | 'arm64-sha *dartsdk-linux-arm64-release.zip', 39 | }); 40 | var fileSystem = TestFileSystem.build({ 41 | 'versions.json': versions, 42 | 'Dockerfile-debian.template': dockerfileTemplate, 43 | 'beta/bookworm/Dockerfile': '', 44 | }); 45 | 46 | await update.update(fileSystem.fileSystem, read, false); 47 | 48 | expect(fileSystem.contexts, [ 49 | 'versions.json', 50 | 'Dockerfile-debian.template', 51 | 'versions.json', 52 | 'beta/bookworm', 53 | 'beta/bookworm/Dockerfile', 54 | ]); 55 | expect(fileSystem.operations, [ 56 | FileSystemOp.read, 57 | FileSystemOp.read, 58 | FileSystemOp.write, 59 | FileSystemOp.create, 60 | FileSystemOp.write, 61 | ]); 62 | const expected = ''' 63 | ENV DART_CHANNEL beta 64 | ENV DART_VERSION 2.14.0-16.1.beta 65 | ENV DART_SHA256_X64 x64-sha 66 | ENV DART_SHA256_ARM arm-sha 67 | ENV DART_SHA256_ARM64 arm64-sha 68 | '''; 69 | expect( 70 | fileSystem.fileSystem.file('beta/bookworm/Dockerfile').readAsStringSync(), 71 | expected, 72 | ); 73 | }); 74 | 75 | test('update succeeds, dockerfile update forced', () async { 76 | var read = mockRead({ 77 | '/dart-archive/channels/stable/release/latest/VERSION': 78 | '{"version":"2.12.4"}', 79 | '/dart-archive/channels/beta/release/latest/VERSION': 80 | '{"version":"2.13.0-211.14.beta"}', 81 | }); 82 | 83 | var fileSystem = TestFileSystem.build({ 84 | 'versions.json': versions, 85 | 'Dockerfile-debian.template': dockerfileTemplate, 86 | 'stable/bookworm/Dockerfile': ''' 87 | ENV DART_CHANNEL bugged 88 | ENV DART_VERSION weird 89 | ENV DART_SHA256 off 90 | ''', 91 | 'beta/bookworm/Dockerfile': ''' 92 | ENV DART_CHANNEL outdated 93 | ENV DART_VERSION wrong 94 | ENV DART_SHA256 incorrect 95 | ''', 96 | }); 97 | 98 | await update.update(fileSystem.fileSystem, read, true); 99 | 100 | expect(fileSystem.contexts, [ 101 | 'versions.json', 102 | 'Dockerfile-debian.template', 103 | 'versions.json', 104 | 'stable/bookworm', 105 | 'stable/bookworm/Dockerfile', 106 | 'beta/bookworm', 107 | 'beta/bookworm/Dockerfile', 108 | ]); 109 | expect(fileSystem.operations, [ 110 | FileSystemOp.read, 111 | FileSystemOp.read, 112 | FileSystemOp.write, 113 | FileSystemOp.create, 114 | FileSystemOp.write, 115 | FileSystemOp.create, 116 | FileSystemOp.write, 117 | ]); 118 | const expectedBeta = ''' 119 | ENV DART_CHANNEL beta 120 | ENV DART_VERSION 2.13.0-211.14.beta 121 | ENV DART_SHA256_X64 jmn 122 | ENV DART_SHA256_ARM opq 123 | ENV DART_SHA256_ARM64 rst 124 | '''; 125 | expect( 126 | fileSystem.fileSystem.file('beta/bookworm/Dockerfile').readAsStringSync(), 127 | expectedBeta, 128 | ); 129 | 130 | const expectedStable = ''' 131 | ENV DART_CHANNEL stable 132 | ENV DART_VERSION 2.12.4 133 | ENV DART_SHA256_X64 abc 134 | ENV DART_SHA256_ARM def 135 | ENV DART_SHA256_ARM64 ghi 136 | '''; 137 | expect( 138 | fileSystem.fileSystem 139 | .file('stable/bookworm/Dockerfile') 140 | .readAsStringSync(), 141 | expectedStable, 142 | ); 143 | }); 144 | } 145 | -------------------------------------------------------------------------------- /scripts/test/utils.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:file/file.dart'; 6 | import 'package:file/memory.dart'; 7 | import 'package:scripts/src/http.dart'; 8 | 9 | const versions = '''{ 10 | "stable": { 11 | "version": "2.12.4", 12 | "sha256": {"x64": "abc", "arm": "def", "arm64": "ghi"} 13 | }, 14 | "beta": { 15 | "version": "2.13.0-211.14.beta", 16 | "sha256": {"x64": "jmn", "arm": "opq", "arm64": "rst"} 17 | } 18 | }'''; 19 | const dockerfileTemplate = ''' 20 | ENV DART_CHANNEL {{DART_CHANNEL}} 21 | ENV DART_VERSION {{DART_VERSION}} 22 | ENV DART_SHA256_X64 {{DART_SHA256_X64}} 23 | ENV DART_SHA256_ARM {{DART_SHA256_ARM}} 24 | ENV DART_SHA256_ARM64 {{DART_SHA256_ARM64}} 25 | '''; 26 | 27 | final fakeRead = (_, {headers}) => throw 'unimplemented'; 28 | HttpRead mockRead(Map responses) { 29 | return (uri, {headers}) async { 30 | return responses.remove(uri.path) ?? (throw ArgumentError.value(uri.path)); 31 | }; 32 | } 33 | 34 | class TestFileSystem { 35 | final List contexts; 36 | final List operations; 37 | var isTesting = false; 38 | FileSystem fileSystem; 39 | 40 | TestFileSystem(this.fileSystem, this.contexts, this.operations); 41 | 42 | factory TestFileSystem.build(Map files) { 43 | var contexts = []; 44 | var operations = []; 45 | var fileSystem = MemoryFileSystem( 46 | opHandle: (context, op) { 47 | contexts.add(context); 48 | operations.add(op); 49 | }, 50 | ); 51 | for (var file in files.entries) { 52 | fileSystem.file(file.key) 53 | ..createSync(recursive: true) 54 | ..writeAsStringSync(file.value); 55 | } 56 | contexts.clear(); 57 | operations.clear(); 58 | return TestFileSystem(fileSystem, contexts, operations); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /scripts/test/verify_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:file/file.dart'; 6 | import 'package:test/test.dart'; 7 | 8 | import '../bin/verify.dart' as verify; 9 | import 'utils.dart'; 10 | 11 | void main() { 12 | late FileSystem fileSystem; 13 | 14 | setUp(() { 15 | fileSystem = TestFileSystem.build({'versions.json': versions}).fileSystem; 16 | }); 17 | 18 | test('verify succeeds', () async { 19 | var read = mockRead({ 20 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-x64-release.zip.sha256sum': 21 | 'abc *dartsdk-linux-x64-release.zip', 22 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-arm-release.zip.sha256sum': 23 | 'def *dartsdk-linux-arm-release.zip', 24 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-arm64-release.zip.sha256sum': 25 | 'ghi *dartsdk-linux-arm64-release.zip', 26 | '/dart-archive/channels/beta/release/2.13.0-211.14.beta/sdk/dartsdk-linux-x64-release.zip.sha256sum': 27 | 'jmn *dartsdk-linux-x64-release.zip', 28 | '/dart-archive/channels/beta/release/2.13.0-211.14.beta/sdk/dartsdk-linux-arm-release.zip.sha256sum': 29 | 'opq *dartsdk-linux-arm-release.zip', 30 | '/dart-archive/channels/beta/release/2.13.0-211.14.beta/sdk/dartsdk-linux-arm64-release.zip.sha256sum': 31 | 'rst *dartsdk-linux-arm64-release.zip', 32 | }); 33 | 34 | await verify.verify(fileSystem, read); 35 | }); 36 | 37 | test('verify fails', () { 38 | var read = mockRead({ 39 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-x64-release.zip.sha256sum': 40 | 'abc *dartsdk-linux-x64-release.zip', 41 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-arm-release.zip.sha256sum': 42 | 'def *dartsdk-linux-arm-release.zip', 43 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-arm64-release.zip.sha256sum': 44 | 'ghi *dartsdk-linux-arm64-release.zip', 45 | '/dart-archive/channels/beta/release/2.13.0-211.14.beta/sdk/dartsdk-linux-x64-release.zip.sha256sum': 46 | 'jmn *dartsdk-linux-x64-release.zip', 47 | '/dart-archive/channels/beta/release/2.13.0-211.14.beta/sdk/dartsdk-linux-arm-release.zip.sha256sum': 48 | 'wrong-sha *dartsdk-linux-arm-release.zip', 49 | '/dart-archive/channels/beta/release/2.13.0-211.14.beta/sdk/dartsdk-linux-arm64-release.zip.sha256sum': 50 | 'rst *dartsdk-linux-arm64-release.zip', 51 | }); 52 | 53 | expect(() async => await verify.verify(fileSystem, read), throwsStateError); 54 | }); 55 | } 56 | -------------------------------------------------------------------------------- /scripts/test/versions_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:pub_semver/pub_semver.dart'; 6 | import 'package:scripts/src/versions.dart'; 7 | import 'package:test/test.dart'; 8 | 9 | import 'utils.dart'; 10 | 11 | final stable = DartSdkVersion('stable', Version.parse('2.12.4'), { 12 | 'x64': 'abc', 13 | 'arm': 'def', 14 | 'arm64': 'ghi', 15 | }, fakeRead); 16 | final beta = DartSdkVersion('beta', Version.parse('2.13.0-211.6.beta'), { 17 | 'x64': 'jmn', 18 | 'arm': 'opq', 19 | 'arm64': 'rst', 20 | }, fakeRead); 21 | 22 | void main() { 23 | test('fromJson', () { 24 | var versions = versionsFromJson({ 25 | 'stable': { 26 | 'version': '2.12.4', 27 | 'sha256': {'x64': 'abc', 'arm': 'def', 'arm64': 'ghi'}, 28 | }, 29 | 'beta': { 30 | 'version': '2.13.0-211.6.beta', 31 | 'sha256': {'x64': 'jmn', 'arm': 'opq', 'arm64': 'rst'}, 32 | }, 33 | }, fakeRead); 34 | 35 | expect(versions['stable'], stable); 36 | expect(versions['beta'], beta); 37 | expect(versions['stable']?.tags, [ 38 | '2.12.4-sdk', 39 | '2.12-sdk', 40 | '2-sdk', 41 | 'stable-sdk', 42 | 'sdk', 43 | '2.12.4', 44 | '2.12', 45 | '2', 46 | 'stable', 47 | 'latest', 48 | ]); 49 | expect(versions['beta']?.tags, [ 50 | '2.13.0-211.6.beta-sdk', 51 | 'beta-sdk', 52 | '2.13.0-211.6.beta', 53 | 'beta', 54 | ]); 55 | expect(versions['stable']?.sha256, { 56 | 'x64': 'abc', 57 | 'arm': 'def', 58 | 'arm64': 'ghi', 59 | }); 60 | expect(versions['beta']?.sha256, { 61 | 'x64': 'jmn', 62 | 'arm': 'opq', 63 | 'arm64': 'rst', 64 | }); 65 | }); 66 | 67 | test('update, no update', () async { 68 | var read = mockRead({ 69 | '/dart-archive/channels/stable/release/latest/VERSION': 70 | '{"version":"2.12.4"}', 71 | }); 72 | var version = DartSdkVersion('stable', Version.parse('2.12.4'), {}, read); 73 | expect(await version.update(), false); 74 | }); 75 | 76 | test('update, new version', () async { 77 | var read = mockRead({ 78 | '/dart-archive/channels/stable/release/latest/VERSION': 79 | '{"version":"3.13.2"}', 80 | '/dart-archive/channels/stable/release/3.13.2/sdk/dartsdk-linux-x64-release.zip.sha256sum': 81 | 'abc *dartsdk-linux-x64-release.zip', 82 | '/dart-archive/channels/stable/release/3.13.2/sdk/dartsdk-linux-arm-release.zip.sha256sum': 83 | 'def *dartsdk-linux-arm-release.zip', 84 | '/dart-archive/channels/stable/release/3.13.2/sdk/dartsdk-linux-arm64-release.zip.sha256sum': 85 | 'ghi *dartsdk-linux-arm64-release.zip', 86 | }); 87 | var version = DartSdkVersion('stable', Version.parse('2.12.4'), {}, read); 88 | expect(await version.update(), true); 89 | expect( 90 | version, 91 | DartSdkVersion('stable', Version.parse('3.13.2'), { 92 | 'x64': 'abc', 93 | 'arm': 'def', 94 | 'arm64': 'ghi', 95 | }, fakeRead), 96 | ); 97 | }); 98 | 99 | test('verify version succeeds', () async { 100 | var read = mockRead({ 101 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-x64-release.zip.sha256sum': 102 | 'x64-sha *dartsdk-linux-x64-release.zip', 103 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-arm-release.zip.sha256sum': 104 | 'arm-sha *dartsdk-linux-arm-release.zip', 105 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-arm64-release.zip.sha256sum': 106 | 'arm64-sha *dartsdk-linux-arm64-release.zip', 107 | }); 108 | var sha256 = {'x64': 'x64-sha', 'arm': 'arm-sha', 'arm64': 'arm64-sha'}; 109 | var version = DartSdkVersion( 110 | 'stable', 111 | Version.parse('2.12.4'), 112 | sha256, 113 | read, 114 | ); 115 | await version.verify(); 116 | }); 117 | 118 | test('verify version fails', () async { 119 | var read = mockRead({ 120 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-x64-release.zip.sha256sum': 121 | 'x64-sha *dartsdk-linux-x64-release.zip', 122 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-arm-release.zip.sha256sum': 123 | 'arm-sha *dartsdk-linux-arm-release.zip', 124 | '/dart-archive/channels/stable/release/2.12.4/sdk/dartsdk-linux-arm64-release.zip.sha256sum': 125 | 'arm64-sha *dartsdk-linux-arm64-release.zip', 126 | }); 127 | var sha256 = {'x64': 'wrong-sha', 'arm': 'wrong-sha', 'arm64': 'wrong-sha'}; 128 | var version = DartSdkVersion( 129 | 'stable', 130 | Version.parse('2.12.4'), 131 | sha256, 132 | read, 133 | ); 134 | expect(() async => await version.verify(), throwsStateError); 135 | }); 136 | } 137 | -------------------------------------------------------------------------------- /stable/bookworm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bookworm-slim 2 | 3 | RUN set -eux; \ 4 | apt-get update; \ 5 | apt-get install -y --no-install-recommends \ 6 | ca-certificates \ 7 | curl \ 8 | dnsutils \ 9 | git \ 10 | openssh-client \ 11 | unzip \ 12 | ; \ 13 | rm -rf /var/lib/apt/lists/* 14 | 15 | # Create a minimal runtime environment for executing AOT-compiled Dart code 16 | # with the smallest possible image size. 17 | # usage: COPY --from=dart:xxx /runtime/ / 18 | # uses hard links here to save space 19 | RUN set -eux; \ 20 | case "$(dpkg --print-architecture)" in \ 21 | amd64) \ 22 | TRIPLET="x86_64-linux-gnu" ; \ 23 | FILES="/lib64/ld-linux-x86-64.so.2" ;; \ 24 | armhf) \ 25 | TRIPLET="arm-linux-gnueabihf" ; \ 26 | FILES="/lib/ld-linux-armhf.so.3 \ 27 | /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3";; \ 28 | arm64) \ 29 | TRIPLET="aarch64-linux-gnu" ; \ 30 | FILES="/lib/ld-linux-aarch64.so.1 \ 31 | /lib/aarch64-linux-gnu/ld-linux-aarch64.so.1" ;; \ 32 | *) \ 33 | echo "Unsupported architecture" ; \ 34 | exit 5;; \ 35 | esac; \ 36 | FILES="$FILES \ 37 | /etc/nsswitch.conf \ 38 | /etc/ssl/certs \ 39 | /usr/share/ca-certificates \ 40 | /lib/$TRIPLET/libc.so.6 \ 41 | /lib/$TRIPLET/libdl.so.2 \ 42 | /lib/$TRIPLET/libm.so.6 \ 43 | /lib/$TRIPLET/libnss_dns.so.2 \ 44 | /lib/$TRIPLET/libpthread.so.0 \ 45 | /lib/$TRIPLET/libresolv.so.2 \ 46 | /lib/$TRIPLET/librt.so.1"; \ 47 | for f in $FILES; do \ 48 | dir=$(dirname "$f"); \ 49 | mkdir -p "/runtime$dir"; \ 50 | cp --archive --link --dereference --no-target-directory "$f" "/runtime$f"; \ 51 | done 52 | 53 | ENV DART_SDK /usr/lib/dart 54 | ENV PATH $DART_SDK/bin:/root/.pub-cache/bin:$PATH 55 | 56 | WORKDIR /root 57 | RUN set -eux; \ 58 | case "$(dpkg --print-architecture)" in \ 59 | amd64) \ 60 | DART_SHA256=0d58c010a361f3f1588b1c2f57942f7ccaf7b7abbe03404fef7a102eb638f09d; \ 61 | SDK_ARCH="x64";; \ 62 | armhf) \ 63 | DART_SHA256=02adb724b0b684573f7630b3d79ef729f8cf9fff561f5170bcc195ee2477e1e6; \ 64 | SDK_ARCH="arm";; \ 65 | arm64) \ 66 | DART_SHA256=78a3240097bee3b79b009c69ead22e1aaedededcbe093eaa980084c5661096c8; \ 67 | SDK_ARCH="arm64";; \ 68 | esac; \ 69 | SDK="dartsdk-linux-${SDK_ARCH}-release.zip"; \ 70 | BASEURL="https://storage.googleapis.com/dart-archive/channels"; \ 71 | URL="$BASEURL/stable/release/3.8.1/sdk/$SDK"; \ 72 | echo "SDK: $URL" >> dart_setup.log ; \ 73 | curl -fLO "$URL"; \ 74 | echo "$DART_SHA256 *$SDK" \ 75 | | sha256sum --check --status --strict -; \ 76 | unzip "$SDK" && mv dart-sdk "$DART_SDK" && rm "$SDK" \ 77 | && chmod 755 "$DART_SDK" && chmod 755 "$DART_SDK/bin"; 78 | -------------------------------------------------------------------------------- /versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "stable": { 3 | "version": "3.8.1", 4 | "sha256": { 5 | "x64": "0d58c010a361f3f1588b1c2f57942f7ccaf7b7abbe03404fef7a102eb638f09d", 6 | "arm": "02adb724b0b684573f7630b3d79ef729f8cf9fff561f5170bcc195ee2477e1e6", 7 | "arm64": "78a3240097bee3b79b009c69ead22e1aaedededcbe093eaa980084c5661096c8" 8 | } 9 | }, 10 | "beta": { 11 | "version": "3.9.0-196.1.beta", 12 | "sha256": { 13 | "x64": "d97e026a18428748fc3b4fd7762a6e6b03c44954ba5245d7ebef448832ad3efc", 14 | "arm": "51522ceae050f3d6aeedd6a3702992daa34d8aca6e316ef8c33e46e3a3656ea6", 15 | "arm64": "e60b9ffd7b5fe2bbc8ee35c492521ba6bc07c94bac64ae7199ca77df737d61a3" 16 | } 17 | } 18 | } --------------------------------------------------------------------------------