Skip to content

Instantly share code, notes, and snippets.

@lsmag

lsmag/Dockerfile Secret

Last active December 12, 2019 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsmag/aeb520908cc16d475072741bcc9d21e6 to your computer and use it in GitHub Desktop.
Save lsmag/aeb520908cc16d475072741bcc9d21e6 to your computer and use it in GitHub Desktop.
# Running `ldd` on the container-based executable from the host
$ ldd hello
linux-vdso.so.1 (0x00007fff61986000)
libgambit.so.4 => not found
libc.so.6 => /usr/lib/libc.so.6 (0x00007f9185b30000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f9185d4e000)
# The same executable, from within the container itself
$ ldd hello
linux-vdso.so.1 (0x00007ffebdf80000)
libgambit.so.4 => /usr/lib/x86_64-linux-gnu/libgambit.so.4 (0x00007f7e923f8000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7e92238000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f7e92233000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7e9222e000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7e920e9000)
libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f7e92057000)
libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f7e91d6a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7e92a4e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7e91d49000)
# After recompiling using host gerbil (arch linux, same args as the docker invocation)
$ ldd hello
linux-vdso.so.1 (0x00007ffdc258c000)
libutil.so.1 => /usr/lib/libutil.so.1 (0x00007f0e4f02f000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f0e4f02a000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f0e4eee4000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f0e4ed1d000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f0e4f69b000)
FROM debian:sid
ARG UNAME=myuser
ARG UID=1000
ARG GID=1000
ARG GERBIL_VERSION=v0.15.1 # FWIW, this is overriden on invocation to `master`
ARG GERBIL_HOME=/opt/gerbil
RUN apt-get update \
&& apt-get install -y \
build-essential \
gambc \
openssl \
libssl-dev \
sqlite3 \
libsqlite3-dev \
zlib1g-dev \
git \
&& rm -rf /var/lib/apt-get/lists/*
RUN git clone https://github.com/vyzo/gerbil.git $GERBIL_HOME
RUN cd $GERBIL_HOME \
&& git checkout $GERBIL_VERSION \
&& cd src/ \
&& ./build.sh
VOLUME /usr/src
RUN groupadd -g $GID -o $UNAME \
&& useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
USER $UNAME
ENV PATH="$GERBIL_HOME/bin:$PATH" \
GERBIL_HOME="$GERBIL_HOME"
CMD /bin/bash
package: hello
(export main)
(def (main . args)
(displayln "hello world"))
build:
docker run -it --rm \
-v $(shell pwd):/usr/src \
-w /usr/src \
$(CST_GERBIL_DOCKER) \
gxc -static -exe -o hello hello.ss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment