forked from videah/SkyBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
55 lines (43 loc) · 1.66 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Official Dart image: https://hub.docker.com/_/dart
# Specify the Dart SDK base image version using dart:<version> (ex: dart:2.17)
FROM dart:3.2.4 AS build
WORKDIR /app
# Resolve app dependencies.
COPY pubspec.* ./
RUN dart pub get
RUN dart pub global activate dart_frog_cli
# Copy app source code and AOT compile it.
COPY . .
# Install Node.js LTS.
RUN set -uex; \
apt-get update; \
apt-get install -y ca-certificates curl gnupg; \
mkdir -p /etc/apt/keyrings; \
curl -fsSL https://deb.nodesource.com/setup_21.x | bash - && \
apt-get install -y nodejs
RUN npm i [email protected]
RUN npx prisma generate
# Generate a production build.
RUN dart pub global activate dart_frog_cli 0.3.8
RUN dart pub global run dart_frog_cli:dart_frog build
# Ensure packages are still up-to-date if anything has changed.
RUN dart pub get --offline
RUN dart compile exe build/server/server.dart -o build/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 dart:stable AS runtime
RUN set -uex; \
apt-get update; \
apt-get install -y ca-certificates curl gnupg; \
mkdir -p /etc/apt/keyrings; \
curl -fsSL https://deb.nodesource.com/setup_21.x | bash - && \
apt-get install -y nodejs
RUN npm i [email protected]
COPY --from=odroe/prisma-dart:latest / /runtime
COPY --from=build /app/build/bin/server /app/bin/
COPY --from=build /app/build/public /app/public/
COPY --from=build /app/entrypoint.sh /app/
COPY --from=build /app/prisma /app/prisma
COPY --from=build /app/node_modules/prisma/query-engine-* /app/bin/
# Start the server.
CMD ["/app/entrypoint.sh"]