-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from psibi/master
Add static binary as part of releases
- Loading branch information
Showing
4 changed files
with
51 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM fpco/alpine-haskell-stack:9.2.5 | ||
|
||
COPY . /app | ||
|
||
RUN apk add upx \ | ||
&& env STACK_YAML=/app/stack.yaml stack --system-ghc install --local-bin-path /app --flag pid1:static \ | ||
&& upx --best /app/pid1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# List all recipies | ||
default: | ||
just --list --unsorted | ||
|
||
# Build image | ||
build-image: | ||
docker build --file Dockerfile . --tag pid1 | ||
|
||
# Copy static binary from container | ||
copy-static-pid1: build-image | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
CID=$(docker create pid1) | ||
docker cp ${CID}:/app/pid1 . | ||
docker rm ${CID} | ||
ls -lah pid1 | ||
# Sanity test the binary | ||
test: | ||
file ./pid1 | ||
./pid1 -- ps |