code sharing sample: flat package directory (#1486)

pull/1489/head
Kevin Moore 2 years ago committed by GitHub
parent c21fcd6573
commit 6caaa0a3c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,9 +1,15 @@
# Use latest stable channel SDK.
FROM dart:stable AS build
# Copy shared code.
WORKDIR /shared
COPY /shared/. .
# Copy server code.
WORKDIR /server
COPY /server/. .
# Resolve app dependencies.
WORKDIR /app
COPY . .
RUN dart pub get
# AOT compile app.
@ -13,7 +19,7 @@ RUN dart compile exe bin/server.dart -o bin/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/server /app/bin/
COPY --from=build /server/bin/server /app/bin/
# Start server.
EXPOSE 8080

@ -19,6 +19,6 @@ test:
# Docker
build:
(cd server && flutter pub get)
docker build ./server -t codesharingserver -f server/Dockerfile
(cd server && dart pub get)
docker build . -t codesharingserver

@ -32,13 +32,13 @@ code_sharing/
server/
bin/
server.dart
# Common business logic
shared/
pubspec.yaml
lib/
...
pubspec.yaml
Dockerfile
# Common business logic
shared/
pubspec.yaml
lib/
...
```
## Recreating this on your own

@ -78,7 +78,11 @@ class _MyHomePageState extends State<MyHomePage> {
(int val) => setState(
() {
_counter = val;
isWriting = true;
// Leave this up for at least a split second
Future.delayed(
const Duration(milliseconds: 200),
() => setState(() => isWriting = false),
);
},
),
);

@ -12,7 +12,7 @@ dependencies:
sdk: flutter
http: ^0.13.5
shared:
path: ../server/shared
path: ../shared
dev_dependencies:
flutter_lints: ^2.0.0

@ -2,7 +2,7 @@ version: "3.7"
services:
server:
build:
context: server
context: .
ports:
- 8080:8080
environment:

@ -1,9 +1,12 @@
.dockerignore
Dockerfile
build/
.dart_tool/
docker-compose.yml
Makefile
README.md
*/build/
*/.dart_tool/
.git/
.github/
.gitignore
.idea/
.packages
*/.idea/
*/.packages

@ -11,7 +11,7 @@ dependencies:
shelf: ^1.1.0
shelf_router: ^1.0.0
shared:
path: ./shared
path: ../shared
dev_dependencies:
http: ^0.13.0

@ -17,7 +17,7 @@ declare -ar PROJECT_NAMES=(
"animations"
"code_sharing/client"
"code_sharing/server"
"code_sharing/server/shared"
"code_sharing/shared"
"desktop_photo_search/fluent_ui"
"desktop_photo_search/material"
"experimental/federated_plugin/federated_plugin"

Loading…
Cancel
Save