Unverified Commit c22423c3 authored by Vincent Sellier's avatar Vincent Sellier
Browse files

Install node on docker image for konnectors

parent 284c78b9
FROM debian:stable-slim AS installer
ARG COZY_VERSION=2018M2S5
ARG NODE_VERSION=8.11.3
WORKDIR /tmp
RUN apt-get update && apt-get -y install wget
RUN apt-get update && apt-get -y install wget xz-utils
COPY install.sh /
RUN chmod u+x /install.sh
......@@ -12,21 +13,32 @@ RUN /install.sh
FROM debian:stable-slim
RUN apt-get update && apt-get -y install git imagemagick && rm -rf /var/cache/apt
RUN groupadd --gid 1000 cozy && useradd --gid 1000 --uid 1000 -m -d /usr/local/cozy-stack cozy && mkdir /etc/cozy && chown cozy:cozy /etc/cozy
RUN apt-get update && apt-get -y install git imagemagick \
&& rm -rf /var/cache/apt
RUN groupadd --gid 1000 cozy && useradd --gid 1000 --uid 1000 -m -d /usr/local/cozy-stack cozy \
&& mkdir /etc/cozy && chown cozy:cozy /etc/cozy \
&& mkdir /usr/local/cozy-stack/scripts
# Docker cloud still not support --chown option, even the edge version
#COPY --chown=cozy:cozy --from=installer /tmp/cozy /usr/local/cozy-stack/cozy
#COPY --chown=cozy:cozy --from=installer /tmp/node /usr/local/node
#COPY --chown=cozy:cozy entrypoint.sh /entrypoint.sh
#COPY --chown=cozy:cozy cozy.yaml /etc/cozy/cozy.yaml
#ADD --chown=cozy:cozy https://raw.githubusercontent.com/cozy/cozy-stack/2018M2S5/scripts/konnector-node-run.sh /usr/local/cozy-stack/scripts/
## Workaround
COPY --from=installer /tmp/cozy /usr/local/cozy-stack/cozy
COPY --from=installer /tmp/node /usr/local/node
COPY entrypoint.sh /entrypoint.sh
COPY cozy.yaml /etc/cozy/cozy.yaml
RUN chown cozy:cozy /usr/local/cozy-stack/cozy /entrypoint.sh /etc/cozy/cozy.yaml
ADD https://raw.githubusercontent.com/cozy/cozy-stack/2018M2S5/scripts/konnector-node-run.sh /usr/local/cozy-stack/scripts/
RUN chown cozy:cozy /usr/local/cozy-stack/cozy /usr/local/cozy-stack/scripts/konnector-node-run.sh /entrypoint.sh /etc/cozy/cozy.yaml
## End of the Workaround
RUN chmod u+x /entrypoint.sh
RUN chmod u+x /entrypoint.sh /usr/local/cozy-stack/scripts/konnector-node-run.sh
# Raspberry hack for node
RUN if uname -m | grep -Eq "arm"; then ln -s /lib/ld-linux.so.3 /lib/ld-linux-armhf.so.3; fi
RUN ln -s /usr/local/node/bin/node /usr/bin/node
USER cozy
......
#!/bin/bash
#!/bin/bash -eu
ARCH=$(uname -m)
COZY_ARCH=""
NODE_ARCH=""
if [[ $ARCH =~ "x86" ]]; then
COZY_ARCH=amd64
NODE_ARCH=x64
elif [[ $ARCH =~ "arm" ]]; then
COZY_ARCH=arm
NODE_ARCH=armv7l
else
echo "Unknown arch $ARCH"
exit 1
fi
echo "Install cozy-stack..."
wget -O /tmp/cozy https://github.com/cozy/cozy-stack/releases/download/${COZY_VERSION}/cozy-stack-linux-${COZY_ARCH}-${COZY_VERSION}
chmod u+x /tmp/cozy
echo "Install nodejs..."
wget -O /tmp/node.tar.xz https://nodejs.org/dist/v8.11.3/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz
tar -xv --use-compress-program xz -f node.tar.xz
mv node-v${NODE_VERSION}-linux-${NODE_ARCH} node
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment