Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit dfc6ea5

Browse files
feat: add dart example to custom container docs (#607)
1 parent 3a3685f commit dfc6ea5

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/pages/reference/custom-containers.mdx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,35 @@ RUN apk update && \
171171
ENTRYPOINT ["/bin/main"]
172172
```
173173

174+
```docker {{ title: "Dart" }}
175+
FROM dart:stable AS build
176+
177+
ARG HANDLER
178+
179+
WORKDIR /app/
180+
181+
# Resolve app dependencies.
182+
COPY pubspec.* ./
183+
RUN dart pub get
184+
185+
# Ensure the ./bin folder exists
186+
RUN mkdir -p ./bin
187+
188+
# Copy app source code and AOT compile it.
189+
COPY . .
190+
191+
# Ensure packages are still up-to-date if anything has changed
192+
RUN dart pub get --offline
193+
RUN dart compile exe ./${HANDLER} -o bin/main
194+
195+
FROM alpine
196+
197+
COPY --from=build /runtime/ /
198+
COPY --from=build /app/bin/main /app/bin/
199+
200+
ENTRYPOINT ["/app/bin/main"]
201+
```
202+
174203
</CodeGroup>
175204

176205
### Create an ignore file

0 commit comments

Comments
 (0)