diff --git a/opendatakit-build/Dockerfile b/opendatakit-build/Dockerfile index c587f8d..2b5f3b4 100644 --- a/opendatakit-build/Dockerfile +++ b/opendatakit-build/Dockerfile @@ -2,11 +2,19 @@ FROM ruby MAINTAINER Disassembler RUN \ - # Install runtime dependencies - apk --no-cache add libpq + # Install NodeJS runtime + apk --no-cache add nodejs paxctl \ + # Fix grsec attributes to loosen memory protection restrictions + && paxctl -cm /usr/bin/node \ + # Cleanup + && apk --no-cache del paxctl RUN \ - # Install build dependencies + # Install runtime dependencies + apk --no-cache add libpq s6 + +RUN \ + # Install build dependencies for ODK Build apk --no-cache add --virtual .deps build-base git linux-headers openjdk8-jre-base paxctl postgresql-dev \ # Fix grsec attributes to loosen memory protection restrictions && paxctl -cm /usr/lib/jvm/java-1.8-openjdk/jre/bin/java \ @@ -26,8 +34,22 @@ RUN \ && find /srv/odkbuild -name '.git*' -exec rm -rf {} + \ && rm -rf /root/.bundle +RUN \ + # Install build dependencies for build2xlsform + apk --no-cache add --virtual .deps git make \ + # Clone build2xlsform + && git clone --depth 1 https://github.com/opendatakit/build2xlsform /srv/build2xlsform \ + && cd /srv/build2xlsform \ + && make \ + # Change ownership + && chown -R odkbuild:odkbuild /srv/build2xlsform \ + # Cleanup + && apk --no-cache del .deps \ + && find /srv/build2xlsform -name '.git*' -exec rm -rf {} + \ + && rm -rf /root/.config /root/.npm + +COPY docker/ / + EXPOSE 8017 -USER odkbuild -WORKDIR /srv/odkbuild -CMD ["bundle", "exec", "rackup", "config.ru", "-o", "0.0.0.0", "-p", "8017"] +CMD ["s6-svscan", "/etc/services.d"] diff --git a/opendatakit-build/docker/etc/services.d/.s6-svscan/finish b/opendatakit-build/docker/etc/services.d/.s6-svscan/finish new file mode 100755 index 0000000..78d5fdc --- /dev/null +++ b/opendatakit-build/docker/etc/services.d/.s6-svscan/finish @@ -0,0 +1,3 @@ +#!/bin/sh + +/bin/true diff --git a/opendatakit-build/docker/etc/services.d/build2xlsform/run b/opendatakit-build/docker/etc/services.d/build2xlsform/run new file mode 100755 index 0000000..befea46 --- /dev/null +++ b/opendatakit-build/docker/etc/services.d/build2xlsform/run @@ -0,0 +1,6 @@ +#!/bin/execlineb -P + +cd /srv/build2xlsform +fdmove -c 2 1 +s6-setuidgid 8017:8017 +node lib/server.js diff --git a/opendatakit-build/docker/etc/services.d/odkbuild/run b/opendatakit-build/docker/etc/services.d/odkbuild/run new file mode 100755 index 0000000..c2d3468 --- /dev/null +++ b/opendatakit-build/docker/etc/services.d/odkbuild/run @@ -0,0 +1,6 @@ +#!/bin/execlineb -P + +cd /srv/odkbuild +fdmove -c 2 1 +s6-setuidgid 8017:8017 +bundle exec rackup config.ru -o 0.0.0.0 -p 8017