Skip to content

Enhance Dockerfile to make it build and run in a container #628

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
73 changes: 43 additions & 30 deletions docker/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,47 @@ ENV OTP_VERSION="20.2"

RUN set -xe \
&& apk add --no-cache --virtual .fetch-deps \
curl \
ca-certificates \
curl \
ca-certificates \
&& curl -fSL -o otp-src.tar.gz "http://www.erlang.org/download/otp_src_20.2.tar.gz" \
&& apk add --no-cache --virtual .build-deps \
dpkg-dev dpkg \
gcc \
g++ \
libc-dev \
linux-headers \
make \
autoconf \
ncurses-dev \
openssl-dev \
unixodbc-dev \
lksctp-tools-dev \
tar \
nodejs \
git \
yarn \
dpkg-dev dpkg \
bash \
gcc \
g++ \
libc-dev \
linux-headers \
make \
autoconf \
ncurses-dev \
openssl-dev \
unixodbc-dev \
lksctp-tools-dev \
tar \
nodejs \
git \
yarn \
&& export ERL_TOP="/usr/src/otp_src_${OTP_VERSION%%@*}" \
&& mkdir -vp $ERL_TOP \
&& tar -xzf otp-src.tar.gz -C $ERL_TOP --strip-components=1 \
&& rm otp-src.tar.gz \
&& ( cd $ERL_TOP \
&& ./otp_build autoconf \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& ./configure --build="$gnuArch" \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install ) \
&& ./otp_build autoconf \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& ./configure --build="$gnuArch" \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install ) \
&& rm -rf $ERL_TOP \
&& find /usr/local -regex '/usr/local/lib/erlang/\(lib/\|erts-\).*/\(man\|doc\|obj\|c_src\|emacs\|info\|examples\)' | xargs rm -rf \
&& find /usr/local -name src | xargs -r find | grep -v '\.hrl$' | xargs rm -v || true \
&& find /usr/local -name src | xargs -r find | xargs rmdir -vp || true \
&& scanelf --nobanner -E ET_EXEC -BF '%F' --recursive /usr/local | xargs -r strip --strip-all \
&& scanelf --nobanner -E ET_DYN -BF '%F' --recursive /usr/local | xargs -r strip --strip-unneeded \
&& runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)" \
&& REBAR3_DOWNLOAD_URL="https://s3.amazonaws.com/rebar3/rebar3" \
&& curl -fSL -o rebar3 "$REBAR3_DOWNLOAD_URL" \
Expand All @@ -53,8 +54,20 @@ RUN set -xe \
&& install -v ./rebar3 /usr/local/bin/ \
&& rm -rf /usr/src/rebar3-src \
&& apk add --virtual .erlang-rundeps \
$runDeps \
lksctp-tools \
ca-certificates
$runDeps \
lksctp-tools \
ca-certificates

CMD ["erl"]
ADD ./ ./dderl

RUN cd dderl \
&& export NO_OCI=true \
&& rebar3 compile \
&& cd priv/dev \
&& yarn \
&& yarn build

EXPOSE 8443

WORKDIR /dderl
CMD ["./start.sh"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ WEB DataBase Browser Application.
1. `./start.sh`
1. go to https://127.0.0.1:8443/dderl in your browser

### Build and run with docker

You can also build and run dderl with docker to avoid installing all the dependencies on your system:

1. `git clone https://github.com/K2InformaticsGmbH/dderl` in `$ROOT`
1. cd `$ROOT/dderl`
1. `docker build . -t dderl:3.6.1`
1. `docker run -p 8443:8443 -ti dderl:3.6.1`
1. go to https://127.0.0.1:8443/dderl in your browser

### Features

1. Browse mnesia and oracle tables in the browser
Expand Down
2 changes: 1 addition & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ imem_opts=$imem_opts" cold_start_recover false"

# dderl opts
dderl_opts="-dderl"
dderl_opts=$dderl_opts" port $dderlport"
dderl_opts=$dderl_opts" interface \"0.0.0.0\" port $dderlport"
Copy link
Member

Choose a reason for hiding this comment

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

In #629 (review) PR default interface are changed to 0.0.0.0 where the env variables are declared. Which makes this redundant.


lager_config="dderl.config"

Expand Down