Skip to content

Commit 863a8b0

Browse files
committed
Move to official Dart docker image
1 parent 057a582 commit 863a8b0

File tree

3 files changed

+46
-44
lines changed

3 files changed

+46
-44
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.dart_tool/
2+
pubspec.lock

Dockerfile

+17-24
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
1-
## Make a self-contained executable out of the application.
2-
FROM google/dart AS dart-runtime
3-
WORKDIR /app
4-
ADD pubspec.* /app/
5-
RUN pub get
6-
ADD bin /app/bin/
7-
ADD lib /app/lib/
8-
ADD static /app/static/
9-
RUN dart2native /app/bin/server.dart -o /app/bin/server
1+
# Specify the Dart SDK base image version using dart:<version> (ex: dart:2.12)
2+
FROM dart:2.12 AS build
103

11-
## Build a bare minimum image for serving.
12-
FROM scratch
4+
# Resolve app dependencies.
5+
WORKDIR /app
6+
COPY pubspec.* .
7+
RUN dart pub get
138

14-
# Server and server dependencies.
15-
COPY --from=dart-runtime /app/bin/server /app/bin/server
16-
COPY --from=dart-runtime /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
17-
COPY --from=dart-runtime /lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/libc.so.6
18-
COPY --from=dart-runtime /lib/x86_64-linux-gnu/libm.so.6 /lib/x86_64-linux-gnu/libm.so.6
19-
COPY --from=dart-runtime /lib/x86_64-linux-gnu/libpthread.so.0 /lib/x86_64-linux-gnu/libpthread.so.0
20-
COPY --from=dart-runtime /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so.2
21-
COPY --from=dart-runtime /lib/x86_64-linux-gnu/librt.so.1 /lib/x86_64-linux-gnu/librt.so.1
9+
# Copy app source code and AOT compile it.
10+
COPY . .
11+
RUN dart pub get --offline
12+
RUN dart compile exe bin/server.dart -o /server
2213

23-
# Other files.
24-
COPY --from=dart-runtime /app/static/favicon.ico /app/static/favicon.ico
25-
COPY --from=dart-runtime /app/lib/sdk_labels.json /app/lib/sdk_labels.json
14+
# Build minimal serving image from AOT-compiled `/server` and required system
15+
# libraries and configuration files stored in `/runtime/` from the build stage.
16+
FROM scratch
17+
COPY --from=build /runtime/ /
18+
COPY --from=build /server /bin/
2619

27-
## Setup for serving.
28-
ENTRYPOINT ["/app/bin/server"]
20+
# Start server.
2921
EXPOSE 8080
22+
CMD ["/bin/server"]

pubspec.lock

+27-20
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ packages:
77
name: _fe_analyzer_shared
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "17.0.0"
10+
version: "21.0.0"
1111
analyzer:
1212
dependency: transitive
1313
description:
1414
name: analyzer
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.1.0"
17+
version: "1.5.0"
1818
args:
1919
dependency: transitive
2020
description:
2121
name: args
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "2.0.0"
24+
version: "2.1.0"
2525
async:
2626
dependency: transitive
2727
description:
2828
name: async
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "2.5.0"
31+
version: "2.6.1"
3232
boolean_selector:
3333
dependency: transitive
3434
description:
@@ -70,49 +70,56 @@ packages:
7070
name: coverage
7171
url: "https://pub.dartlang.org"
7272
source: hosted
73-
version: "1.0.1"
73+
version: "1.0.2"
7474
crypto:
7575
dependency: transitive
7676
description:
7777
name: crypto
7878
url: "https://pub.dartlang.org"
7979
source: hosted
80-
version: "3.0.0"
80+
version: "3.0.1"
8181
file:
8282
dependency: transitive
8383
description:
8484
name: file
8585
url: "https://pub.dartlang.org"
8686
source: hosted
87-
version: "6.1.0"
87+
version: "6.1.1"
88+
frontend_server_client:
89+
dependency: transitive
90+
description:
91+
name: frontend_server_client
92+
url: "https://pub.dartlang.org"
93+
source: hosted
94+
version: "2.1.0"
8895
github:
8996
dependency: "direct dev"
9097
description:
9198
name: github
9299
url: "https://pub.dartlang.org"
93100
source: hosted
94-
version: "8.0.1"
101+
version: "8.1.0"
95102
glob:
96103
dependency: transitive
97104
description:
98105
name: glob
99106
url: "https://pub.dartlang.org"
100107
source: hosted
101-
version: "2.0.0"
108+
version: "2.0.1"
102109
http:
103110
dependency: transitive
104111
description:
105112
name: http
106113
url: "https://pub.dartlang.org"
107114
source: hosted
108-
version: "0.13.0"
115+
version: "0.13.3"
109116
http_multi_server:
110117
dependency: transitive
111118
description:
112119
name: http_multi_server
113120
url: "https://pub.dartlang.org"
114121
source: hosted
115-
version: "3.0.0"
122+
version: "3.0.1"
116123
http_parser:
117124
dependency: transitive
118125
description:
@@ -140,14 +147,14 @@ packages:
140147
name: json_annotation
141148
url: "https://pub.dartlang.org"
142149
source: hosted
143-
version: "4.0.0"
150+
version: "4.0.1"
144151
logging:
145152
dependency: transitive
146153
description:
147154
name: logging
148155
url: "https://pub.dartlang.org"
149156
source: hosted
150-
version: "1.0.0"
157+
version: "1.0.1"
151158
matcher:
152159
dependency: transitive
153160
description:
@@ -217,7 +224,7 @@ packages:
217224
name: shelf
218225
url: "https://pub.dartlang.org"
219226
source: hosted
220-
version: "1.0.0"
227+
version: "1.1.4"
221228
shelf_packages_handler:
222229
dependency: transitive
223230
description:
@@ -238,7 +245,7 @@ packages:
238245
name: shelf_web_socket
239246
url: "https://pub.dartlang.org"
240247
source: hosted
241-
version: "1.0.0"
248+
version: "1.0.1"
242249
source_map_stack_trace:
243250
dependency: transitive
244251
description:
@@ -294,21 +301,21 @@ packages:
294301
name: test
295302
url: "https://pub.dartlang.org"
296303
source: hosted
297-
version: "1.16.7"
304+
version: "1.17.4"
298305
test_api:
299306
dependency: transitive
300307
description:
301308
name: test_api
302309
url: "https://pub.dartlang.org"
303310
source: hosted
304-
version: "0.3.0"
311+
version: "0.4.0"
305312
test_core:
306313
dependency: transitive
307314
description:
308315
name: test_core
309316
url: "https://pub.dartlang.org"
310317
source: hosted
311-
version: "0.3.18"
318+
version: "0.3.24"
312319
typed_data:
313320
dependency: transitive
314321
description:
@@ -322,7 +329,7 @@ packages:
322329
name: vm_service
323330
url: "https://pub.dartlang.org"
324331
source: hosted
325-
version: "6.1.0+1"
332+
version: "6.2.0"
326333
watcher:
327334
dependency: transitive
328335
description:
@@ -336,7 +343,7 @@ packages:
336343
name: web_socket_channel
337344
url: "https://pub.dartlang.org"
338345
source: hosted
339-
version: "2.0.0"
346+
version: "2.1.0"
340347
webkit_inspection_protocol:
341348
dependency: transitive
342349
description:

0 commit comments

Comments
 (0)