Fares 10 月之前
父節點
當前提交
986ff22d6b
共有 3 個文件被更改,包括 53 次插入0 次删除
  1. 0 0
      bin/server.dart
  2. 22 0
      tp5/shelf/Dockerfile
  3. 31 0
      tp5/shelf/docker-compose.yml

+ 0 - 0
bin/main.dart → bin/server.dart


+ 22 - 0
tp5/shelf/Dockerfile

@@ -0,0 +1,22 @@
+# Use latest stable channel SDK.
+FROM dart:stable AS build
+
+# Resolve app dependencies.
+WORKDIR /app
+COPY ./app/pubspec.* ./
+RUN dart pub get
+
+# Copy app source code (except anything in .dockerignore) and AOT compile app.
+COPY ./app .
+RUN dart pub get --offline
+RUN dart compile exe bin/main.dart -o bin/main --target-os linux
+
+# Build minimal serving image from AOT-compiled `/server`
+# and the pre-built AOT-runtime in the `/runtime/` directory of the base image.
+# FROM scratch
+# COPY --from=build /runtime/ /
+# COPY --from=build /app/bin/main /app/bin/
+
+# Start server.
+EXPOSE 8080
+CMD ["/app/bin/main"]

+ 31 - 0
tp5/shelf/docker-compose.yml

@@ -0,0 +1,31 @@
+#version: '3.8'
+
+services:
+  dart_server:
+    image: dart:latest
+    volumes:
+      - ./app:/app
+    working_dir: /app
+    #command: dart run bin/server.dart
+    #ports:
+    #  - "8082:8080"
+
+# services:
+#   tp5-shelf:
+#     build:
+#       context: .
+#       dockerfile: Dockerfile
+#     volumes:
+#       - ./app:/app
+#     # ports:
+#     #   - "8081:8080"
+#     #environment:
+#       # Add any environment variables needed for your application here
+#       # Example: MY_ENV_VAR: "value"
+#     restart: unless-stopped
+
+
+networks:
+  default:
+    name: caddy-network
+    external: true