Custom devcontainer dockerfile for Swift with swift-format.
Last active
May 21, 2024 17:23
-
-
Save kreeger/1261ffea759979e6f14d5fb37ee9b9f2 to your computer and use it in GitHub Desktop.
Custom devcontainer dockerfile for Swift with swift-format.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"name": "Swift", | |
"build": { | |
"dockerfile": "Dockerfile", | |
"args": { | |
"SWIFT_VERSION": "5.10", | |
"SWIFT_FORMAT_VERSION": "510.1.0" | |
} | |
}, | |
"features": { | |
"ghcr.io/devcontainers/features/common-utils:2": { | |
"installZsh": "false", | |
"username": "vscode", | |
"userUid": "1000", | |
"userGid": "1000", | |
"upgradePackages": "false" | |
}, | |
"ghcr.io/devcontainers/features/git:1": { | |
"version": "os-provided", | |
"ppa": "false" | |
} | |
}, | |
"runArgs": [ | |
"--cap-add=SYS_PTRACE", | |
"--security-opt", | |
"seccomp=unconfined" | |
], | |
// Configure tool-specific properties. | |
"customizations": { | |
// Configure properties specific to VS Code. | |
"vscode": { | |
// Set *default* container specific settings.json values on container create. | |
"settings": { | |
"lldb.library": "/usr/lib/liblldb.so" | |
}, | |
// Add the IDs of extensions you want installed when the container is created. | |
"extensions": [ | |
"sswg.swift-lang", | |
"vknabel.vscode-apple-swift-format" | |
] | |
} | |
}, | |
// Use 'forwardPorts' to make a list of ports inside the container available locally. | |
// "forwardPorts": [], | |
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | |
"remoteUser": "vscode" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG SWIFT_VERSION="5.10" | |
FROM swift:${SWIFT_VERSION} | |
ARG SWIFT_FORMAT_VERSION="510.1.0" | |
RUN git clone --depth 1 --branch $SWIFT_FORMAT_VERSION https://github.com/apple/swift-format.git &&\ | |
cd swift-format &&\ | |
swift build -c release &&\ | |
mkdir -p /usr/local/bin &&\ | |
mv .build/release/swift-format /usr/local/bin/swift-format |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment