Closed MarwaneKoutar closed 4 months ago
Looks good to me @MarwaneKoutar, thanks. @shahmishal can you have a look and merge if OK ? Do you think we need to update the SLIM version as well ? (I don't think so, as the objectives of the SLIM version is to be as small as possible)
@shahmishal
I understand your concern to not open the door to vendor requests and to keep the image as small as possible. However, I would like you to consider these three points:
1/ this is Amazon Linux and AWS SDK for Swift. This image is used by AWS customers using Swift, the vast majority will need to install the AWS SDK on it. I'm not asking to add this package on all Linux images, just the Amazon one.
2/ The slim images exist and they are minimal, a customer that wants the smallest possible image will use the slim version
3/ both Apple and Amazon are focus on customer experience. Given the fact that this is an Amazon Linux image, to be deployed on AWS, we want to give the best possible DX to our common customers.
Let me know what the team decision is. Thanks
@sebsto Thanks for the explanation! This does make sense because Amazon Linux 2 docker images are mostly used on AWS platforms.
@swift-ci test
Please also update the 5.10 Dockerfile. Thanks!
Hey @shahmishal, I've just updated it. Thank you!
@swift-ci test
@swift-ci test
@shahmishal could you please have a look at that?
This looks good, I just noticed we would also want this updated on the nightly Dockerfiles too.
@shahmishal would you like to also have this update on the buildx Dockerfiles? I've added it on the nightly-main too, is that good?
Yes buildx too, thanks!
@swift-ci test
@MarwaneKoutar Please let me know once you have buildx
updated. Thanks
@shahmishal Sorry I've missed your last message. I just updated the buildx ones.
@shahmishal Could you review it please?
@swift-ci test
@shahmishal Hello Mishal,
I noticed the builds at Docker Hub are based on a 4 months commit.
Do you know when this pull request will land into Docker hub ? We're block on another project with this dependency
Thank you !
I just test the image swift:5.10-amazonlinux2
today
https://hub.docker.com/layers/library/swift/5.10-amazonlinux2/images/sha256-12e5f88e33b3c997ad16502fea3c1287c4a00757d63a04fc669e3cac3a9795ce?context=explore
and I confirm this change landed well.
Thank you !
@MarwaneKoutar Time to update the build script of the SAM tLambda templates at https://github.com/swift-server-community/aws-lambda-swift-sam-template
Swift build for AWS Lambda failing
When using the command "swift package --disable-sandbox plugin archive" to build a Swift Lambda function that has aws-sdk-swift as a dependency, the build of it will fail because of a missing package in the image it uses. This is why I added openssl-devel in the install section.
Reproducing the Bug
for example
make sure to put this into Sources/HelloWorld/LambdaHandler.swift
import PackageDescription
let package = Package( name: "aws-swift-app", platforms: [.macOS(.v12)], products: [ .executable(name: "HelloWorld", targets: ["HelloWorld"]) ], dependencies: [ .package(url: "https://github.com/swift-server/swift-aws-lambda-runtime", branch: "main"), .package(url: "https://github.com/awslabs/aws-sdk-swift", from: "0.37.0") ], targets: [ .executableTarget( name: "HelloWorld", dependencies: [ .product(name: "AWSLambdaRuntime",package: "swift-aws-lambda-runtime"), .product(name: "AWSDynamoDB",package: "aws-sdk-swift"), ] ) ] )
The Error
The project would start compiling until it prints this:
Which basically says that it is missing some files
The Fix
Adding openssl-devel to the installed packages in the amazonlinux2 image which is the image that swift package uses.