Skip to content

Commit

Permalink
i
Browse files Browse the repository at this point in the history
  • Loading branch information
hanl5 committed Oct 9, 2024
1 parent e0d79c3 commit 13ed41f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 43 deletions.
8 changes: 5 additions & 3 deletions docker/swift_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ cd "$(
pwd -P
)/" || exit

echo "~~~ build grpc server swift ~~~"
echo "~~~ build grpc swift ~~~"
# docker images | grep swift
rm -rf hello-grpc-swift
mkdir hello-grpc-swift
cp -r ../hello-grpc-swift/* hello-grpc-swift/
#docker build -f swift_grpc.dockerfile --target builder -t feuyeux/grpc_swift:1.0.0 .
#
# for cache the working layers
docker build -f swift_grpc.dockerfile --target builder -t feuyeux/grpc_swift:1.0.0 .
echo
echo "~~~ build grpc server swift ~~~"
docker build -f swift_grpc.dockerfile --target server -t feuyeux/grpc_server_swift:1.0.0 .
echo
echo "~~~ build grpc client swift ~~~"
Expand Down
81 changes: 41 additions & 40 deletions docker/swift_grpc.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,32 @@ WORKDIR /building
RUN swift package resolve
RUN swift build -c release
# 收集依赖库
COPY swift_pkg_deps.sh /usr/bin/pkg-swift-deps
RUN chmod +x /usr/bin/pkg-swift-deps
# COPY swift_pkg_deps.sh /usr/bin/pkg-swift-deps
# RUN chmod +x /usr/bin/pkg-swift-deps
# RUN pkg-swift-deps /building/.build/x86_64-unknown-linux-gnu/release/HelloServer
# pkg-swift-deps /building/.build/x86_64-unknown-linux-gnu/release/HelloClient

FROM swift:6.0.1 AS server
COPY --from=builder /usr/lib/swift/linux/libswiftCore.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswiftGlibc.so /usr/lib/swift/linux/
COPY --from=builder /lib/x86_64-linux-gnu/libm.so.6 /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libFoundation.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswiftDispatch.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libdispatch.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libBlocksRuntime.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswift_RegexParser.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswift_StringProcessing.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswift_Concurrency.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswiftCore.so /usr/lib/swift/linux/
COPY --from=builder /lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/swift/linux/
COPY --from=builder /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/swift/linux/
COPY --from=builder /lib/x86_64-linux-gnu/libgcc_s.so.1 /usr/lib/swift/linux/
COPY --from=builder /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/swift/linux/
COPY --from=builder /lib64/ld-linux-x86-64.so.2 /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libicuucswift.so.65 /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libicui18nswift.so.65 /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libicudataswift.so.65 /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswiftCore.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswiftGlibc.so /usr/lib/swift/linux/
# COPY --from=builder /lib/x86_64-linux-gnu/libm.so.6 /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libFoundation.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswiftDispatch.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libdispatch.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libBlocksRuntime.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswift_RegexParser.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswift_StringProcessing.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswift_Concurrency.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswiftCore.so /usr/lib/swift/linux/
# COPY --from=builder /lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/swift/linux/
# COPY --from=builder /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/swift/linux/
# COPY --from=builder /lib/x86_64-linux-gnu/libgcc_s.so.1 /usr/lib/swift/linux/
# COPY --from=builder /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/swift/linux/
# COPY --from=builder /lib64/ld-linux-x86-64.so.2 /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libicuucswift.so.65 /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libicui18nswift.so.65 /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libicudataswift.so.65 /usr/lib/swift/linux/

#
COPY --from=builder /building/.build/x86_64-unknown-linux-gnu/release/HelloServer /hello-grpc-swift/
WORKDIR /hello-grpc-swift
Expand All @@ -43,25 +44,25 @@ RUN chmod +x HelloServer
CMD ["/hello-grpc-swift/HelloServer"]

FROM swift:6.0.1 AS client
COPY --from=builder /usr/lib/swift/linux/libswiftCore.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswiftGlibc.so /usr/lib/swift/linux/
COPY --from=builder /lib/x86_64-linux-gnu/libm.so.6 /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libFoundation.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswiftDispatch.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libdispatch.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libBlocksRuntime.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswift_RegexParser.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswift_StringProcessing.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswift_Concurrency.so /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libswiftCore.so /usr/lib/swift/linux/
COPY --from=builder /lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/swift/linux/
COPY --from=builder /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/swift/linux/
COPY --from=builder /lib/x86_64-linux-gnu/libgcc_s.so.1 /usr/lib/swift/linux/
COPY --from=builder /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/swift/linux/
COPY --from=builder /lib64/ld-linux-x86-64.so.2 /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libicuucswift.so.65 /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libicui18nswift.so.65 /usr/lib/swift/linux/
COPY --from=builder /usr/lib/swift/linux/libicudataswift.so.65 /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswiftCore.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswiftGlibc.so /usr/lib/swift/linux/
# COPY --from=builder /lib/x86_64-linux-gnu/libm.so.6 /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libFoundation.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswiftDispatch.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libdispatch.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libBlocksRuntime.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswift_RegexParser.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswift_StringProcessing.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswift_Concurrency.so /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libswiftCore.so /usr/lib/swift/linux/
# COPY --from=builder /lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/swift/linux/
# COPY --from=builder /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/swift/linux/
# COPY --from=builder /lib/x86_64-linux-gnu/libgcc_s.so.1 /usr/lib/swift/linux/
# COPY --from=builder /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/swift/linux/
# COPY --from=builder /lib64/ld-linux-x86-64.so.2 /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libicuucswift.so.65 /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libicui18nswift.so.65 /usr/lib/swift/linux/
# COPY --from=builder /usr/lib/swift/linux/libicudataswift.so.65 /usr/lib/swift/linux/
#
COPY --from=builder /building/.build/x86_64-unknown-linux-gnu/release/HelloClient /hello-grpc-swift/
WORKDIR /hello-grpc-swift
Expand Down

0 comments on commit 13ed41f

Please sign in to comment.