Skip to content
Merged

24.04 #253

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
45 changes: 23 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
FROM opendronemap/odm:latest
MAINTAINER Piero Toffanin <pt@masseranolabs.com>

EXPOSE 3000

USER root
RUN apt-get update && apt-get install -y curl gpg-agent
RUN curl --silent --location https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs unzip p7zip-full && npm install -g nodemon && \
ln -s /code/SuperBuild/install/bin/untwine /usr/bin/untwine && \
ln -s /code/SuperBuild/install/bin/entwine /usr/bin/entwine && \
ln -s /code/SuperBuild/install/bin/pdal /usr/bin/pdal


RUN mkdir /var/www

WORKDIR "/var/www"
COPY . /var/www

RUN npm install --production && mkdir -p tmp

ENTRYPOINT ["/usr/bin/node", "/var/www/index.js"]
FROM opendronemap/odm:latest
MAINTAINER Piero Toffanin <pt@masseranolabs.com>

EXPOSE 3000

USER root

RUN mkdir /var/www

WORKDIR "/var/www"
COPY . /var/www

ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 14

RUN bash install_deps.sh && \
ln -s /code/SuperBuild/install/bin/untwine /usr/bin/untwine && \
ln -s /code/SuperBuild/install/bin/entwine /usr/bin/entwine && \
ln -s /code/SuperBuild/install/bin/pdal /usr/bin/pdal && \
ln -s /var/www/node.sh /usr/bin/node && \
mkdir -p tmp && node index.js --powercycle

ENTRYPOINT ["/usr/bin/node", "/var/www/index.js"]
13 changes: 8 additions & 5 deletions Dockerfile.gpu
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ MAINTAINER Piero Toffanin <pt@masseranolabs.com>
EXPOSE 3000

USER root
RUN apt-get update && apt-get install -y curl gpg-agent ca-certificates
RUN curl --silent --location https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs unzip p7zip-full && npm install -g nodemon && \

ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 14

RUN bash install_deps.sh && \
ln -s /code/SuperBuild/install/bin/untwine /usr/bin/untwine && \
ln -s /code/SuperBuild/install/bin/entwine /usr/bin/entwine && \
ln -s /code/SuperBuild/install/bin/pdal /usr/bin/pdal
ln -s /code/SuperBuild/install/bin/pdal /usr/bin/pdal && \
ln -s /var/www/node.sh /usr/bin/node

RUN echo /usr/local/cuda-11.2/compat >> /etc/ld.so.conf.d/989_cuda-11.conf && ldconfig

Expand All @@ -19,7 +22,7 @@ WORKDIR "/var/www"
RUN useradd -m -d "/home/odm" -s /bin/bash odm
COPY --chown=odm:odm . /var/www

RUN npm install --production && mkdir -p tmp
RUN npm install --production && mkdir -p tmp && node index.js --powercycle

RUN chown -R odm:odm /var/www
RUN chown -R odm:odm /code
Expand Down
17 changes: 13 additions & 4 deletions helpers/odmOptionsToJson.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,33 @@
'''

import sys
import imp
import importlib.util
import importlib.machinery
import types
import argparse
import json
import os

def load_source(module_name, filename):
loader = importlib.machinery.SourceFileLoader(module_name, filename)
module = types.ModuleType(loader.name)
module.__file__ = filename
loader.exec_module(module)
return module

dest_file = os.environ.get("ODM_OPTIONS_TMP_FILE")

sys.path.append(sys.argv[2])

try:
imp.load_source('opendm', sys.argv[2] + '/opendm/__init__.py')
load_source('opendm', sys.argv[2] + '/opendm/__init__.py')
except:
pass
try:
imp.load_source('context', sys.argv[2] + '/opendm/context.py')
load_source('context', sys.argv[2] + '/opendm/context.py')
except:
pass
odm = imp.load_source('config', sys.argv[2] + '/opendm/config.py')
odm = load_source('config', sys.argv[2] + '/opendm/config.py')

options = {}
class ArgumentParserStub(argparse.ArgumentParser):
Expand Down
30 changes: 30 additions & 0 deletions install_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

if [ -z "$NVM_DIR" ]; then
echo "Error: NVM_DIR environment variable is not set" >&2
exit 1
fi
if [ -z "$NODE_VERSION" ]; then
echo "Error: NODE_VERSION environment variable is not set" >&2
exit 1
fi

for i in {1..20}; do
apt-get update && apt-get install -y curl gpg-agent && break
echo "apt-get failed, retrying... ($i/20)"
sleep 30
done

mkdir -p $NVM_DIR
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
source $NVM_DIR/nvm.sh
nvm install $NODE_VERSION
nvm alias default $NODE_VERSION

for i in {1..20}; do
apt-get install -y unzip p7zip-full && npm install -g nodemon && break
echo "apt-get failed, retrying... ($i/20)"
sleep 30
done

npm install --production
2 changes: 1 addition & 1 deletion libs/odmRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ module.exports = {
}

let childProcess = spawn(pythonExe, [shQuote(path.join(__dirname, "..", "helpers", "odmOptionsToJson.py")),
"--project-path", shQuote(config.odm_path), "bogusname"], { env, stdio: 'inherit', shell: true });
"--project-path", shQuote(config.odm_path), "bogusname"], { env, shell: true });

// Cleanup on done
let handleResult = (err, result) => {
Expand Down
10 changes: 10 additions & 0 deletions node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

if [ -z "$NVM_DIR" ]; then
echo "Error: NVM_DIR environment variable is not set" >&2
exit 1
fi

source $NVM_DIR/nvm.sh
nvm use $NODE_VERSION
exec node "$@"
Loading