Skip to content

Commit 301aaf0

Browse files
committed
Update Dockerfile, add node.sh wrapper
1 parent 2dc1819 commit 301aaf0

4 files changed

Lines changed: 59 additions & 30 deletions

File tree

Dockerfile

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
FROM opendronemap/odm:latest
2-
MAINTAINER Piero Toffanin <pt@masseranolabs.com>
3-
4-
EXPOSE 3000
5-
6-
USER root
7-
RUN apt-get update && apt-get install -y curl gpg-agent
8-
RUN curl --silent --location https://deb.nodesource.com/setup_14.x | bash -
9-
RUN apt-get install -y nodejs unzip p7zip-full && npm install -g nodemon && \
10-
ln -s /code/SuperBuild/install/bin/untwine /usr/bin/untwine && \
11-
ln -s /code/SuperBuild/install/bin/entwine /usr/bin/entwine && \
12-
ln -s /code/SuperBuild/install/bin/pdal /usr/bin/pdal
13-
14-
15-
RUN mkdir /var/www
16-
17-
WORKDIR "/var/www"
18-
COPY . /var/www
19-
20-
RUN npm install --production && mkdir -p tmp
21-
22-
ENTRYPOINT ["/usr/bin/node", "/var/www/index.js"]
1+
FROM opendronemap/odm:latest
2+
MAINTAINER Piero Toffanin <pt@masseranolabs.com>
3+
4+
EXPOSE 3000
5+
6+
USER root
7+
8+
RUN mkdir /var/www
9+
10+
WORKDIR "/var/www"
11+
COPY . /var/www
12+
13+
ENV NVM_DIR /usr/local/nvm
14+
ENV NODE_VERSION 14
15+
16+
RUN bash install_deps.sh && \
17+
ln -s /code/SuperBuild/install/bin/untwine /usr/bin/untwine && \
18+
ln -s /code/SuperBuild/install/bin/entwine /usr/bin/entwine && \
19+
ln -s /code/SuperBuild/install/bin/pdal /usr/bin/pdal && \
20+
ln -s /var/www/node.sh /usr/bin/node && \
21+
mkdir -p tmp && node index.js --powercycle
22+
23+
ENTRYPOINT ["/usr/bin/node", "/var/www/index.js"]

Dockerfile.gpu

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ MAINTAINER Piero Toffanin <pt@masseranolabs.com>
44
EXPOSE 3000
55

66
USER root
7-
RUN apt-get update && apt-get install -y curl gpg-agent ca-certificates
8-
RUN curl --silent --location https://deb.nodesource.com/setup_14.x | bash -
9-
RUN apt-get install -y nodejs unzip p7zip-full && npm install -g nodemon && \
7+
8+
ENV NVM_DIR /usr/local/nvm
9+
ENV NODE_VERSION 14
10+
11+
RUN bash install_deps.sh && \
1012
ln -s /code/SuperBuild/install/bin/untwine /usr/bin/untwine && \
1113
ln -s /code/SuperBuild/install/bin/entwine /usr/bin/entwine && \
12-
ln -s /code/SuperBuild/install/bin/pdal /usr/bin/pdal
14+
ln -s /code/SuperBuild/install/bin/pdal /usr/bin/pdal && \
15+
ln -s /var/www/node.sh /usr/bin/node
1316

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

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

22-
RUN npm install --production && mkdir -p tmp
25+
RUN npm install --production && mkdir -p tmp && node index.js --powercycle
2326

2427
RUN chown -R odm:odm /var/www
2528
RUN chown -R odm:odm /code

install_deps.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
#!/bin/bash
22

3+
if [ -z "$NVM_DIR" ]; then
4+
echo "Error: NVM_DIR environment variable is not set" >&2
5+
exit 1
6+
fi
7+
if [ -z "$NODE_VERSION" ]; then
8+
echo "Error: NODE_VERSION environment variable is not set" >&2
9+
exit 1
10+
fi
11+
312
for i in {1..20}; do
413
apt-get update && apt-get install -y curl gpg-agent && break
514
echo "apt-get failed, retrying... ($i/20)"
615
sleep 30
716
done
817

9-
curl --silent --location https://deb.nodesource.com/setup_14.x | bash -
18+
mkdir -p $NVM_DIR
19+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
20+
source $NVM_DIR/nvm.sh
21+
nvm install $NODE_VERSION
22+
nvm alias default $NODE_VERSION
1023

1124
for i in {1..20}; do
12-
apt-get install -y nodejs npm unzip p7zip-full && npm install -g nodemon && break
25+
apt-get install -y unzip p7zip-full && npm install -g nodemon && break
1326
echo "apt-get failed, retrying... ($i/20)"
1427
sleep 30
15-
done
28+
done
29+
30+
npm install --production

node.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
if [ -z "$NVM_DIR" ]; then
4+
echo "Error: NVM_DIR environment variable is not set" >&2
5+
exit 1
6+
fi
7+
8+
source $NVM_DIR/nvm.sh
9+
nvm use $NODE_VERSION
10+
exec node "$@"

0 commit comments

Comments
 (0)