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

[---] Build docker executable with musl libc. #751

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM busybox:glibc
FROM busybox

MAINTAINER "André Stein <[email protected]>"

Expand Down
10 changes: 10 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine:edge
looked-at-me marked this conversation as resolved.
Show resolved Hide resolved

RUN apk add --no-cache g++ clang \
zlib-dev zlib-static curl-dev curl-static openssl openssl-dev openssl-libs-static \
ldc dub dtools-rdmd

COPY docker.build.sh /docker.build.sh
RUN chmod +x /docker.build.sh

ENTRYPOINT [ "/docker.build.sh" ]
9 changes: 9 additions & 0 deletions ci/docker.build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
set -e -u

cd /core/
dub build -c static --compiler=ldc2

# remove dub folder generated with build
# as it has root permissions from docker in the build folder
rm -rf ./.dub/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the rm inside of the docker image ? It doesn't make much sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker is run with a root user, the folder is generated inside the build folder it is connected to. Without this the remove outside would need root access, which it doesn't have.

4 changes: 3 additions & 1 deletion ci/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ dub --compiler=${DC} -- --sanitycheck

# Compile to static binary with ldc
if [[ "${DC}" == "ldc2" ]]; then
dub build -c static --compiler=${DC}
docker build -t dlangtour_build ./ci/
docker run --rm -v `pwd`:/core/ -ti dlangtour_build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the interactive run ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from the docker run below.


docker build -t dlangtour_test_image ./
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -ti dlangtour_test_image --wait-until-pulled --sanitycheck
fi