zeus
3 years ago
6 changed files with 134 additions and 1 deletions
@ -0,0 +1,61 @@ |
|||
ARG NODE_VERSION=6.17.1 |
|||
FROM mhart/alpine-node:${NODE_VERSION} |
|||
|
|||
LABEL \ |
|||
org.opencontainers.image.title="Docker Image of nodejs4poc" \ |
|||
org.opencontainers.image.authors="Swarmlab.io <rootapostolos@swarmlab.io>" |
|||
|
|||
#ENV PATH=/usr/local/texlive/bin/x86_64-linuxmusl:/usr/local/texlive/2020/bin/x86_64-linuxmusl:${PATH} |
|||
|
|||
ENV dockeruser node |
|||
|
|||
ENV USERhome=${dockeruser} |
|||
ENV UID=12345 |
|||
ENV GID=23456 |
|||
|
|||
RUN addgroup -S node \ |
|||
&& adduser -D -g "" -h "/home/${USERhome}" -G "${USERhome}" -u "${UID}" "${USERhome}" |
|||
|
|||
COPY \ |
|||
setup.sh \ |
|||
extrapackages \ |
|||
repositories \ |
|||
/root/ |
|||
|
|||
# -------- next line is in setup.sh ------ |
|||
# ----------edit if not alpine ---------- |
|||
# copy repositories /etc/apk/repositories |
|||
# -------------------------------------- |
|||
|
|||
RUN /root/setup.sh |
|||
|
|||
|
|||
# nodejs npm install --- opencv----- uncomment -------------------------- |
|||
ARG USER1=node |
|||
ARG NODEPROJECT1-src=playground-client/playground-client |
|||
ARG NODEPROJECT1=playground-client |
|||
|
|||
ENV USER1 ${USER1} |
|||
ENV NODEPROJECTSRC ${NODEPROJECT1-src} |
|||
ENV NODEPROJECT ${NODEPROJECT1} |
|||
|
|||
|
|||
COPY ${NODEPROJECTSRC} /home/${USER1}/${NODEPROJECT} |
|||
|
|||
RUN chown -R ${USER1}.${USER1} /home/${USER1} |
|||
USER ${USER1} |
|||
|
|||
RUN /home/${USER1}/${NODEPROJECT}/install-npm.sh |
|||
|
|||
WORKDIR /home/${USER1} |
|||
|
|||
|
|||
USER root |
|||
USER ${USER1} |
|||
|
|||
WORKDIR /home/${dockeruser} |
|||
VOLUME ["/home/${dockeruser}"] |
|||
|
|||
EXPOSE 8080 |
|||
|
|||
CMD ["tail","-f","/dev/null"] |
@ -0,0 +1,5 @@ |
|||
|
|||
git clone https://git.swarmlab.io:3000/swarmlab/poc-datacollector.git |
|||
|
|||
|
|||
docker build -f Dockerfile -t hub.swarmlab.io:5443/opencv4nodejswebcam . |
@ -1,2 +1 @@ |
|||
# playground-poc-node |
|||
|
|||
|
@ -0,0 +1,5 @@ |
|||
curl |
|||
cmake |
|||
zlib |
|||
unzip |
|||
build-base |
@ -0,0 +1,2 @@ |
|||
http://dl-cdn.alpinelinux.org/alpine/v3.2/main @community http://dl-cdn.alpinelinux.org/alpine/edge/community |
|||
|
@ -0,0 +1,61 @@ |
|||
#!/bin/sh |
|||
|
|||
set -e |
|||
set -o pipefail |
|||
|
|||
scheme="$1" |
|||
|
|||
retry() { |
|||
retries=$1 |
|||
shift |
|||
|
|||
count=0 |
|||
until "$@"; do |
|||
exit=$? |
|||
wait="$(echo "2^$count" | bc)" |
|||
count="$(echo "$count + 1" | bc)" |
|||
if [ "$count" -lt "$retries" ]; then |
|||
echo "Retry $count/$retries exited $exit, retrying in $wait seconds..." |
|||
sleep "$wait" |
|||
else |
|||
echo "Retry $count/$retries exited $exit, no more retries left." |
|||
return "$exit" |
|||
fi |
|||
done |
|||
} |
|||
|
|||
# --------custom repos ------- |
|||
# alpine edit 4 ubuntu |
|||
#cp /root/repositories /etc/apk/repositories |
|||
|
|||
echo "==> Install system packages" |
|||
apk --no-cache add \ |
|||
bash \ |
|||
gnupg \ |
|||
tar \ |
|||
wget \ |
|||
make \ |
|||
xz |
|||
|
|||
extrap=/root/extrapackages |
|||
if [ -f $extrap ]; then |
|||
|
|||
while read -r line; do |
|||
extrapackages="$extrapackages $line" |
|||
done < $extrap |
|||
|
|||
apk --no-cache add $extrapackages |
|||
|
|||
else |
|||
echo "No extrapackages file" |
|||
fi |
|||
|
|||
echo "==> Install pm2" |
|||
|
|||
npm install pm2@latest -g |
|||
|
|||
echo "==> Clean up" |
|||
rm -rf \ |
|||
/root/.gnupg \ |
|||
/setup.sh \ |
|||
/extrapackages |
Loading…
Reference in new issue