FROM swift:jammy-slim
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends git curl build-essential \
&& rm -rf /var/lib/apt/lists/*
# Build the Swift Package from source
WORKDIR /workspace
COPY . .
# Build the project in release configuration
RUN swift build -c release
# Default to an interactive shell so the container can run even without an executable
CMD ["bash"]
# Exclude git and other system files .git build/ *.log .DS_Store */.DS_Store # SwiftPM build artifacts .swiftpm/ build/ # Xcode project files (not needed for Linux builds) *.xcworkspace *.xcodeproj # Pods (from iOS/CocoaPods usage, not used in Linux builds but keep clean) Pods/
- Exact error message and exit code: - /bin/sh: 1: swift: not found - Exit code: 127 - Failing command/step: - [5/5] RUN swift build -c release - In Dockerfile: RUN swift build -c release - Missing packages or files mentioned: - The swift executable is not found (Swift toolchain missing or not in PATH). - Version mismatch info: - Base image is swift:jammy-slim, but the build ends with swift not found, indicating the expected Swift toolchain is not present in the image despite the base image being intended for Swift. No explicit Swift version is shown in the log.
swift (734 stars): Swift is a high-performance system programming language, to learn more about Swi paketobuildpacks/run-jammy-base (0 stars): paketobuildpacks/build-jammy-base (0 stars): paketobuildpacks/build-jammy-full (0 stars): paketobuildpacks/run-jammy-full (0 stars): paketobuildpacks/build-jammy-tiny (0 stars): paketobuildpacks/run-jammy-tiny (1 stars): kasmweb/core-ubuntu-jammy (13 stars): Ubuntu Jammy base image for Kasm Workspaces kasmweb/ubuntu-jammy-dind (7 stars): Docker for Kasm Workspaces openwhisk/action-swift-v4.2 (0 stars): Apache OpenWhisk runtime for Swift v4.2 Actions
No results found.
No results found.
No results found.
FROM swift:jammy-slim
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends git curl ca-certificates xz \
&& rm -rf /var/lib/apt/lists/*
# Install Swift 5.1 toolchain (Linux) since the base image may not include Swift by default
ARG SWIFT_VERSION=5.1
RUN mkdir -p /usr/local/swift && \
curl -fsSL https://download.swift.org/swift-${SWIFT_VERSION}-RELEASE-ubuntu18.04/swift-${SWIFT_VERSION}-RELEASE-ubuntu18.04.tar.gz -o /tmp/swift.tar.gz && \
tar -xzf /tmp/swift.tar.gz -C /usr/local/swift --strip-components=1 && \
rm /tmp/swift.tar.gz
ENV PATH="/usr/local/swift/usr/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/swift/usr/lib/swift/linux:${LD_LIBRARY_PATH}"
# Build from source
WORKDIR /workspace
COPY . .
# Build the Swift Package from source in release mode
RUN swift build -c release
# Default to an interactive shell so the container can run even without an executable
CMD ["bash"]
- Failing step (command): [2/6] RUN apt-get update && apt-get install -y --no-install-recommends git curl ca-certificates xz && rm -rf /var/lib/apt/lists/* - Exact error message and exit code: - Error message: E: Unable to locate package xz - Exit code: 100 - Missing packages/files mentioned: - xz package not found in the apt repositories during installation - Base image / version context: - Base image: swift:jammy-slim (Ubuntu Jammy) - Additional note (warning found in output): - Warning: UndefinedVar: Usage of undefined variable '$LD_LIBRARY_PATH' (line 16) Summary: The build failed at the apt-get step while trying to install xz, which cannot be located in the jammy repositories, causing exit code 100.
FROM swift:jammy-slim
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends git curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Swift 5.1 toolchain (Linux) since the base image may not include Swift by default
ARG SWIFT_VERSION=5.1
RUN mkdir -p /usr/local/swift && \
curl -fsSL https://download.swift.org/swift-${SWIFT_VERSION}-RELEASE-ubuntu18.04/swift-${SWIFT_VERSION}-RELEASE-ubuntu18.04.tar.gz -o /tmp/swift.tar.gz && \
tar -xzf /tmp/swift.tar.gz -C /usr/local/swift --strip-components=1 && \
rm /tmp/swift.tar.gz
ENV PATH="/usr/local/swift/usr/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/swift/usr/lib/swift/linux:${LD_LIBRARY_PATH}"
# Build from source
WORKDIR /workspace
COPY . .
# Build the Swift Package from source in release mode
RUN swift build -c release
# Default to an interactive shell so the container can run even without an executable
CMD ["bash"]
- Exact error message and exit code:
- curl: (22) The requested URL returned error: 404
- EXIT CODE: 22
- Failing command/step:
- Step [3/6] RUN mkdir -p /usr/local/swift && curl -fsSL https://download.swift.org/swift-${SWIFT_VERSION}-RELEASE-ubuntu18.04/swift-${SWIFT_VERSION}-RELEASE-ubuntu18.04.tar.gz -o /tmp/swift.tar.gz && tar -xzf /tmp/swift.tar.gz -C /usr/local/swift --strip-components=1 && rm /tmp/swift.tar.gz
- Missing packages or files mentioned:
- The Swift toolchain tarball download failed with 404, i.e., the file at the URL is missing:
https://download.swift.org/swift-${SWIFT_VERSION}-RELEASE-ubuntu18.04/swift-${SWIFT_VERSION}-RELEASE-ubuntu18.04.tar.gz
- Version mismatch / context:
- Base image: swift:jammy-slim (Ubuntu 22.04)
- Attempted asset: swift-${SWIFT_VERSION}-RELEASE-ubuntu18.04.tar.gz (Ubuntu 18.04)
- The 404 suggests the 18.04 tarball is not available for this Swift version, indicating a possible OS/version mismatch. Consider using a tarball for Ubuntu 22.04 or a Swift version with an available ubuntu22.04 tarball, or use a base image that already includes the desired Swift toolchain.FROM swift:jammy-slim
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends git curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Build from source using the Swift toolchain included in the image
WORKDIR /workspace
COPY . .
# Build the Swift Package from source in release mode
RUN swift build -c release
# Default to an interactive shell so the container can run even without an executable
CMD ["bash"]
#0 building with "default" instance using docker driver #1 [internal] load build definition from Dockerfile #1 transferring dockerfile: 497B done #1 DONE 0.0s #2 [internal] load metadata for docker.io/library/swift:jammy-slim #2 DONE 0.3s #3 [internal] load .dockerignore #3 transferring context: 324B done #3 DONE 0.0s #4 [1/5] FROM docker.io/library/swift:jammy-slim@sha256:a0d255bfd43611e642fa931ec542b2ed4134caa5eeb11c5c2090ab0de9cf2353 #4 resolve docker.io/library/swift:jammy-slim@sha256:a0d255bfd43611e642fa931ec542b2ed4134caa5eeb11c5c2090ab0de9cf2353 0.0s done #4 DONE 0.0s #5 [2/5] RUN apt-get update && apt-get install -y --no-install-recommends git curl ca-certificates && rm -rf /var/lib/apt/lists/* #5 CACHED #6 [internal] load build context #6 transferring context: 5.97kB done #6 DONE 0.0s #7 [3/5] WORKDIR /workspace #7 DONE 0.1s #8 [4/5] COPY . . #8 DONE 0.1s #9 [5/5] RUN swift build -c release #9 0.178 /bin/sh: 1: swift: not found #9 ERROR: process "/bin/sh -c swift build -c release" did not complete successfully: exit code: 127 ------ > [5/5] RUN swift build -c release: 0.178 /bin/sh: 1: swift: not found ------ Dockerfile:13 -------------------- 11 | 12 | # Build the Swift Package from source in release mode 13 | >>> RUN swift build -c release 14 | 15 | # Default to an interactive shell so the container can run even without an executable -------------------- ERROR: failed to build: failed to solve: process "/bin/sh -c swift build -c release" did not complete successfully: exit code: 127
Image swift:jammy-slim exists on Docker Hub.
ImagePicker is an all-in-one iOS camera solution to pick images from the library and take photos, using referenced images for lower memory usage.
Key usage
- Instantiate and present:
- let imagePickerController = ImagePickerController()
- imagePickerController.delegate = self
- present(imagePickerController, animated: true, completion: nil)
- Delegates:
- wrapperDidPress(_ imagePicker: ImagePickerController, images: [UIImage])
- doneButtonDidPress(_ imagePicker: ImagePickerController, images: [UIImage])
- cancelButtonDidPress(_ imagePicker: ImagePickerController)
Image selection limit
- imageLimit defaults to 0 (unlimited)
- Example: imagePickerController.imageLimit = 5
Optional configuration
- Inject Configuration to customize UI/features:
- var configuration = Configuration()
- configuration.doneButtonTitle = "Finish"
- configuration.noImagesTitle = "Sorry! There are no images here!"
- configuration.recordLocation = false
- let imagePicker = ImagePickerController(configuration: configuration)
Resolve assets (advanced)
- You can override asset handling:
- public var imageAssets: [UIImage] { return AssetManager.resolveAssets(imagePicker.stack.assets) }
- In delegate, start with let images = imageAssets
FAQ: single selection
- Limit to 1 item:
- let config = Configuration()
- config.allowMultiplePhotoSelection = false
- let imagePicker = ImagePickerController(configuration: config)
Installation
- CocoaPods: pod 'ImagePicker'
- Carthage: github "hyperoslo/ImagePicker"
Author/License
- Author: Hyper
- License: MIT
- Contribute: CONTRIBUTING.md
Notes
- Key APIs/packages: ImagePickerController, Configuration, AssetManager, ImagePicker (CocoaPods) and Carthage integration.Image swift:latest exists on Docker Hub.
FROM swift:latest
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends git curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
COPY . .
# Build the Swift Package from source
RUN swift build -c release
CMD ["bash"]
- Failing step - [5/5] RUN swift build -c release - Exit code - exit code: 1 - Exact error message (preserved): 17.54 /workspace/Source/AssetManager.swift:2:8: error: no such module 'UIKit' 1 | import Foundation 2 | import UIKit 3 | import Photos - Missing packages or files mentioned - no such module 'UIKit' - Version mismatch / environment info - Base image: docker.io/library/swift:latest - Issue: UIKit (an Apple iOS/macOS framework) is not available in this Linux-based Swift Docker image, causing a missing module error when compiling AssetManager.swift which imports UIKit. This indicates a target mismatch (iOS/UIKit code being built in a Linux container). - Context - The code path being compiled is ImagePicker/AssetManager.swift, which imports UIKit and Photos, leading to the failure in a Linux Swift build.
# Multi-stage build for ImagePicker SwiftPM library
# Builder stage: use a full Swift toolchain with Linux support
FROM swift:5.9-jammy AS builder
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy source code
COPY . .
# Build the library from source
RUN swift build -c release
# Runtime stage: keep a lean image with the built artifacts
FROM debian:bookworm-slim AS runtime
# Install minimal runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the built product from the builder
COPY --from=builder /app/.build/release /app/.build/release
# Provide an interactive shell by default
CMD ["/bin/bash"]
# Ignore macOS and SwiftPM build artifacts .gitattributes .git .gitignore .swiftpm/ /.build/ .swiftLintCache Packages/ .build/ # Xcode and macOS specific *.xcworkspace *.xcworkspace/ *.xcodeproj # SwiftPM and artifacts Package.resolved
- Exact error message and exit code:
- no such module 'UIKit'
- error: fatalError
- exit code: 1
- Full failure snippet:
- /app/Source/AssetManager.swift:2:8: error: no such module 'UIKit'
- import UIKit
- ^
- error: fatalError
- ...
- ERROR: failed to build: failed to solve: process "/bin/sh -c swift build -c release" did not complete successfully: exit code: 1
- Failing command/step:
- [builder 5/5] RUN swift build -c release
- Dockerfile: line showing the build command:
- >>> RUN swift build -c release
- Missing packages or files mentioned:
- UIKit module is missing (no such module 'UIKit'), indicating a macOS/iOS-specific framework being used in a Linux container.
- Version mismatch information:
- The build runs in a Linux-based Swift image (swift:5.9-jammy) inside Ubuntu Jammy/Debian bookworm context, yet the code imports UIKit, which is an Apple-only framework not available on Linux. This is a platform target mismatch: UIKit cannot be resolved in a Linux container, suggesting the code targets iOS/macOS rather than Linux.# Multi-stage build for ImagePicker SwiftPM library
# Builder stage: use a full Swift toolchain with Linux support
FROM swift:5.9-jammy AS builder
ARG BUILD_IN_CONTAINER=0
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy source code
COPY . .
# Build the library from source if running inside a container (Linux) that can build it
RUN if [ "${BUILD_IN_CONTAINER}" = "1" ]; then \
swift build -c release \
; else \
echo "Skipping swift build: This repository targets iOS/macOS and relies on UIKit. Build on macOS/Xcode to produce artifacts." \
; fi
# Runtime stage: keep a lean image with the built artifacts
FROM debian:bookworm-slim AS runtime
# Install minimal runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the built product from the builder (may be empty if not built)
COPY --from=builder /app/.build /app/.build
# Provide an interactive shell by default
CMD ["/bin/bash"]
Concerns: COPY --from=builder /app/.build /app/.build references a path that may not exist in the builder stage unless a build has run, causing the image build to fail., The build step is optional (BUILD_IN_CONTAINER) and defaults to not producing artifacts; the final runtime image may contain no build artifacts., Swift packages targeting iOS/macOS may rely on UIKit and fail to build on Linux, making the in-container build brittle or impossible without macOS tooling., The runtime image copies /app/.build from the builder even when the build did not produce artifacts, which could lead to an empty or inconsistent final image or a failed build.
Concise summary of actionable items from the tool output
- Imports: Foundation, UIKit, Photos
- Bundle.myResourceBundle()
- Scans allBundles for a resource URL, appends "ImagePicker" and ".bundle"
- Builds Bundle(url: ...)s and returns the first valid one
- AssetManager.getImage(_ name: String) -> UIImage
- Trait: displayScale = 3
- Starts with bundle = Bundle.myResourceBundle()
- If bundle.resourcePath exists, and a sub-bundle at resourcePath + "/ImagePicker.bundle" exists, uses that as the bundle
- Returns UIImage(named: name, in: bundle, compatibleWith: traitCollection) or an empty UIImage() if not found
- AssetManager.fetch(withConfiguration configuration, _ completion: @escaping (_ assets: [PHAsset]) -> Void)
- Requires PHPhotoLibrary authorizationStatus == .authorized, otherwise returns
- Runs in background queue
- If configuration.allowVideoSelection is true:
- fetchResult = PHAsset.fetchAssets(with: PHFetchOptions()) (all assets)
- else:
- fetchResult = PHAsset.fetchAssets(with: .image, options: PHFetchOptions()) (only images)
- If fetchResult.count > 0:
- Accumulates assets by inserting each object at index 0 (reverses order)
- Calls completion(assets) on main thread
- AssetManager.resolveAsset(_ asset: PHAsset, size: CGSize = 720x1280, shouldPreferLowRes: Bool = false, completion: @escaping (_ image: UIImage?) -> Void)
- Uses PHImageManager.default() and PHImageRequestOptions
- deliveryMode: .fastFormat if shouldPreferLowRes, otherwise .highQualityFormat
- isNetworkAccessAllowed = true
- Requests image for asset with targetSize = size, contentMode = .aspectFill
- If info exists and info["PHImageFileUTIKey"] == nil, calls completion(image) on main thread
- AssetManager.resolveAssets(_ assets: [PHAsset], size: CGSize = 720x1280) -> [UIImage]
- Uses synchronous requestOptions (isSynchronous = true)
- For each asset: requestImage(for: asset, targetSize: size, contentMode: .aspectFill, options: requestOptions)
- If image retrieved, appends to result array
- Returns [UIImage]
Notes
- All image fetches respect asynchronous/synchronous behavior as coded
- Access to assets only proceeds when authorized
- Images default to size 720x1280 unless overridden; low-res option uses fastFormat delivery mode
- Bundle resolution relies on an ImagePicker.bundle inside the app’s bundles
# Multi-stage build for ImagePicker SwiftPM library
# Builder stage: use a full Swift toolchain with Linux support
FROM swift:5.9-jammy AS builder
ARG BUILD_FOR_LINUX=0
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy source code
COPY . .
# Build the library from source if requested for Linux; otherwise skip (UIKit/macOS-specific)
RUN if [ "${BUILD_FOR_LINUX}" = "1" ]; then \
swift build -c release \
; else \
echo "Skipping in-container Swift build (UIKit/macOS target)." \
; fi
# Runtime stage: keep a lean image with the repository contents
FROM debian:bookworm-slim AS runtime
# Install minimal runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the repository contents from the builder (even if not built)
COPY --from=builder /app /app
# Provide an interactive shell by default
CMD ["/bin/bash"]
Concerns: By default the image does not build the Swift library; the build only occurs if BUILD_FOR_LINUX=1 is provided at build time, Runtime image lacks Swift toolchain; to verify a build you must build with BUILD_FOR_LINUX=1 and then inspect the result, Consider adding a more explicit non-interactive default CMD or separate build/test stages to better reflect intended usage Smoke [PASS]: test -d /app Smoke [PASS]: ls -la /app