mirror of
https://github.com/Linloir/Simple-TCP-Server.git
synced 2025-12-18 08:28:12 +08:00
23 lines
675 B
Docker
23 lines
675 B
Docker
# Specify the Dart SDK base image version using dart:<version> (ex: dart:2.12)
|
|
FROM dart:stable AS build
|
|
|
|
# Resolve app dependencies.
|
|
WORKDIR /app
|
|
COPY pubspec.* ./
|
|
RUN dart pub get
|
|
|
|
# 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 bin/server.dart -o bin/server
|
|
|
|
# Build minimal serving image from AOT-compiled `/server` and required system
|
|
# libraries and configuration files stored in `/runtime/` from the build stage.
|
|
FROM scratch
|
|
COPY --from=build /runtime/ /
|
|
COPY --from=build /app/bin/server /app/bin/
|
|
|
|
# Start server.
|
|
EXPOSE 20706
|
|
CMD ["/app/bin/server"] |