Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Linux docker setup #852

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git/
.build/
.swiftpm/
.release/
bazel-*
docker/
7 changes: 7 additions & 0 deletions .mise/tasks/scan-linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

export DOCKER_CLI_HINTS=false
docker build -t periphery -f docker/Dockerfile.linux .
docker run --rm -t periphery scan "$@"
10 changes: 5 additions & 5 deletions Sources/Shared/Shell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ open class Shell {

process.launch()

var stdout = ""
var stderr = ""
var standardOutput = ""
var standardError = ""

if let stdoutData = try stdoutPipe?.fileHandleForReading.readToEnd() {
guard let stdoutStr = String(data: stdoutData, encoding: .utf8)
Expand All @@ -90,7 +90,7 @@ open class Shell {
encoding: .utf8
)
}
stdout = stdoutStr
standardOutput = stdoutStr
}

if let stderrData = try stderrPipe?.fileHandleForReading.readToEnd() {
Expand All @@ -102,11 +102,11 @@ open class Shell {
encoding: .utf8
)
}
stderr = stderrStr
standardError = stderrStr
}

process.waitUntilExit()
ShellProcessStore.shared.remove(process)
return (process.terminationStatus, stdout, stderr)
return (process.terminationStatus, standardOutput, standardError)
}
}
5 changes: 5 additions & 0 deletions docker/Dockerfile.linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM swift:latest
WORKDIR /workspace
COPY . /workspace
RUN swift build --product periphery
ENTRYPOINT [".build/debug/periphery"]
Loading