-
-
Save erdnaxeli/f394720b9626d8e3c1e09d31a88c9a1f to your computer and use it in GitHub Desktop.
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
FROM crystallang/crystal:1.0.0-alpine | |
COPY . /src | |
WORKDIR /src | |
RUN crystal build --static test.cr | |
FROM golang:alpine | |
RUN go get -u github.com/vishen/go-chromecast | |
FROM scratch | |
COPY --from=0 /src/test /bin/test | |
COPY --from=1 /go/bin/go-chromecast /bin | |
ENV PATH=/bin | |
ENTRYPOINT ["/bin/test"] |
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
┌─[erdnaxeli@videl:~/bacasable/test]-[22:26:17] | |
└─>$ docker build -t test --network=host . | |
Sending build context to Docker daemon 3.072kB | |
Step 1/11 : FROM crystallang/crystal:1.0.0-alpine | |
---> d090bf999fa4 | |
Step 2/11 : COPY . /src | |
---> d25393145b70 | |
Step 3/11 : WORKDIR /src | |
---> Running in c51d4d13dc4c | |
Removing intermediate container c51d4d13dc4c | |
---> bdba34ab9314 | |
Step 4/11 : RUN crystal build --static test.cr | |
---> Running in 6f9de44b4e86 | |
Removing intermediate container 6f9de44b4e86 | |
---> 574949b91bd4 | |
Step 5/11 : FROM golang:alpine | |
---> 270727b8fd0f | |
Step 6/11 : RUN go get -u github.com/vishen/go-chromecast | |
---> Using cache | |
---> c32a5ef9c930 | |
Step 7/11 : FROM scratch | |
---> | |
Step 8/11 : COPY --from=0 /src/test /bin/test | |
---> Using cache | |
---> 0790736674a9 | |
Step 9/11 : COPY --from=1 /go/bin/go-chromecast /bin | |
---> Using cache | |
---> 6af0a8ee7e74 | |
Step 10/11 : ENV PATH=/bin | |
---> Using cache | |
---> 5e271cf7d2db | |
Step 11/11 : ENTRYPOINT ["/bin/test"] | |
---> Using cache | |
---> 56ad39918111 | |
Successfully built 56ad39918111 | |
Successfully tagged test:latest | |
┌─[erdnaxeli@videl:~/bacasable/test]-[22:26:24] | |
└─>$ docker run --rm --init test | |
File.exists?(bin) # => true | |
File.executable?(bin) # => true | |
File.info?(bin) # => Crystal::System::FileInfo( | |
@stat= | |
LibC::Stat( | |
@__pad0=0, | |
@__unused=StaticArray[0, 0, 0], | |
@st_atim=LibC::Timespec(@tv_nsec=0, @tv_sec=1619162376), | |
@st_blksize=4096, | |
@st_blocks=38672, | |
@st_ctim=LibC::Timespec(@tv_nsec=254242017, @tv_sec=1619209538), | |
@st_dev=56, | |
@st_gid=0, | |
@st_ino=817248, | |
@st_mode=33261, | |
@st_mtim=LibC::Timespec(@tv_nsec=0, @tv_sec=1619162376), | |
@st_nlink=1, | |
@st_rdev=0, | |
@st_size=19798760, | |
@st_uid=0)) | |
(File.read(bin))[..10] # => "\u007FELF\u0002\u0001\u0001\u0000\u0000\u0000\u0000" | |
Unhandled exception: Error executing process: '/bin/go-chromecast': No such file or directory (File::NotFoundError) | |
from usr/share/crystal/src/crystal/system/unix/process.cr:223:7 in 'raise_exception_from_errno' | |
from usr/share/crystal/src/crystal/system/unix/process.cr:156:9 in 'spawn' | |
from usr/share/crystal/src/process.cr:229:5 in 'initialize' | |
from usr/share/crystal/src/process.cr:221:3 in 'new' | |
from usr/share/crystal/src/process.cr:140:5 in '__crystal_main' | |
from usr/share/crystal/src/crystal/main.cr:110:5 in 'main_user_code' | |
from usr/share/crystal/src/crystal/main.cr:96:7 in 'main' | |
from usr/share/crystal/src/crystal/main.cr:119:3 in 'main' | |
from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2' |
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
bin = Process.find_executable("go-chromecast") | |
if bin | |
pp! File.exists?(bin) | |
pp! File.executable?(bin) | |
pp! File.info?(bin) | |
pp! File.read(bin)[..10] | |
Process.run(bin) { |p| p.output.each_line { |l| puts l } } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment