Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/norio-nomura/docker-swiftlint
Docker image of SwiftLint on ubuntu
https://github.com/norio-nomura/docker-swiftlint
docker docker-image dockerfile swift swiftlint ubuntu
Last synced: about 2 months ago
JSON representation
Docker image of SwiftLint on ubuntu
- Host: GitHub
- URL: https://github.com/norio-nomura/docker-swiftlint
- Owner: norio-nomura
- License: mit
- Created: 2017-10-29T08:16:25.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-09T03:58:12.000Z (4 months ago)
- Last Synced: 2024-10-14T03:23:55.517Z (2 months ago)
- Topics: docker, docker-image, dockerfile, swift, swiftlint, ubuntu
- Language: Dockerfile
- Homepage: https://hub.docker.com/r/norionomura/swiftlint/
- Size: 146 KB
- Stars: 13
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# docker-swiftlint
*In this document, using **amd64, arm64** for platform architecture for docker, and **x86_64, aarch64** for Swift architecture.*
## `builder` directory
### Build without Swift SDK (no-sdk)#### Build image for docker host architecture
```bash
docker buildx build --load builder/ -t swiftlint
```#### Build multi-architecture image (x86_64-no-sdk, aarch64-no-sdk)
```bash
docker buildx build --load builder/ -t swiftlint \
--platform linux/amd64,linux/arm64
```### Cross compilation on `BUILDER_IAMGE` using `TARGET_IMAGE` as Swift SDK
Setup `TARGET_IMAGE` as the Swift SDK for the target architecture, and use them from Swift Toolchain in `BUILDER_IMAGE`.Supported combinations of `TARGET_IMAGE` and `BUILDER_IMAGE` are as follows:
| | aarch64 builder | x86_64 builder |
|----------------|--------------------|-------------------|
| aarch64 target | aarch64-on-aarch64 | aarch64-on-x86_64 |
| x86_64 target | x86_64-on-aarch64 | x86_64-on-x86_64 |#### Using `--build-arg USE_SDK=1` for building with Swift SDK
Build arm64 architecture image using Swift SDK (aarch64-on-aarch64)
```bash
docker buildx build --load builder/ -t swiftlint \
--platform linux/arm64 --build-arg USE_SDK=1
```#### Using `--build-arg CROSS=1` for cross compilation with Swift SDK
Build arm64 architecture image on amd64 architecture using Swift SDK (aarch64-on-x86_64)
```bash
docker buildx build --load builder/ -t swiftlint \
--platform linux/arm64 --build-arg CROSS=1
```#### Using `--build-arg CROSS_TARGETARCHS=...` for cross compiling target architectures with Swift SDK
Build multi-architecture image, native compileed arm64 (aarch64-no-sdk), cross compiled amd64 (x86_64-on-aarch64).
```bash
docker buildx build --load builder/ -t swiftlint \
--platform linux/amd64,linux/arm64 --build-arg CROSS_TARGETARCHS=amd64
```
This command minimizes the use of emulation on arm64 host.## `copier` directory
Expected to use `swiftlint` binary built in `builder` directory.## Running aarch64 executable generated with Swift on x86_64 Ubuntu (GitHub Hosted Actions Runner) using `qemu-user-static`
There is a known issue where running an aarch64 executable generated with Swift on x86_64 Ubuntu using the default `qemu-user-static` results in a crash.
https://forums.swift.org/t/swift-runtime-unable-to-suspend-thread-when-compiling-in-qemu/67676This issue can be avoided by using qemu-user-static-7.2 distributed by Debian.
There are two methods to install it:
- For rootful docker, run `docker run --rm --privileged multiarch/qemu-user-static:7.2.0-1 --reset -p yes`.
This method can be used as long as the docker installed on the GitHub Actions Runner is rootful.
- Setup debian sources to apt on host and install it. See [install_qemu_user_static_from_debian](.github/actions/install_qemu_user_static_from_debian/action.yml) as an example.## Author
Norio Nomura
## License
available under the MIT license. See the LICENSE file for more info.