Skip to content

Commit

Permalink
Add Linux docker setup (#852)
Browse files Browse the repository at this point in the history
  • Loading branch information
ileitch authored Dec 26, 2024
1 parent 00c9259 commit d217700
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
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"]

0 comments on commit d217700

Please sign in to comment.