diff --git a/src/pages/reference/custom-containers.mdx b/src/pages/reference/custom-containers.mdx index 41fd48110..11c8910c2 100644 --- a/src/pages/reference/custom-containers.mdx +++ b/src/pages/reference/custom-containers.mdx @@ -171,6 +171,35 @@ RUN apk update && \ ENTRYPOINT ["/bin/main"] ``` +```docker {{ title: "Dart" }} +FROM dart:stable AS build + +ARG HANDLER + +WORKDIR /app/ + +# Resolve app dependencies. +COPY pubspec.* ./ +RUN dart pub get + +# Ensure the ./bin folder exists +RUN mkdir -p ./bin + +# Copy app source code and AOT compile it. +COPY . . + +# Ensure packages are still up-to-date if anything has changed +RUN dart pub get --offline +RUN dart compile exe ./${HANDLER} -o bin/main + +FROM alpine + +COPY --from=build /runtime/ / +COPY --from=build /app/bin/main /app/bin/ + +ENTRYPOINT ["/app/bin/main"] +``` + ### Create an ignore file