From dc942cb08e8943a7fc9fe31e29a38cb592ebfd6f Mon Sep 17 00:00:00 2001 From: Benoit Lavenier <benoit.lavenier@e-is.pro> Date: Wed, 22 Apr 2020 15:44:11 +0200 Subject: [PATCH] [fix] Fix DockerFile --- Dockerfile | 51 ++++++++++++++++++++++------------------- package.json | 4 ++-- scripts/docker-build.sh | 14 +++++++++++ scripts/docker-start.sh | 3 +-- scripts/env-android.sh | 24 +++++-------------- scripts/env-global.sh | 9 +++----- www/manifest.json | 4 ++-- 7 files changed, 55 insertions(+), 54 deletions(-) create mode 100755 scripts/docker-build.sh diff --git a/Dockerfile b/Dockerfile index f1fa4e32..3e8e3d34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ -FROM ubuntu:18.04 +FROM node:10-alpine LABEL maintainer="benoit [dot] lavenier [at] e-is [dot] pro" +LABEL version="1.6.3" +LABEL description="Cesium Wallet for Äž1 libre currency" + +ARG CESIUM_VER="1.6.3" ENV DEBIAN_FRONTEND=noninteractive \ NODE_VERSION=10.20.0 \ @@ -11,28 +15,27 @@ ENV DEBIAN_FRONTEND=noninteractive \ GULP_VERSION=2.2.0 # Install basics -RUN apt-get update && \ - apt-get install -y git wget curl unzip build-essential software-properties-common ruby ruby-dev ruby-ffi gcc make python && \ - curl --retry 3 -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" && \ - tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 && \ - rm "node-v$NODE_VERSION-linux-x64.tar.gz" - -RUN mkdir -p /home/root && \ - chmod -R 777 /home/root -WORKDIR /home/root - -# Install global nodeJS dependencies -RUN npm install -g npm@"$NPM_VERSION" && \ - npm install -g yarn@"$YARN_VERSION" gulp@"$GULP_VERSION" cordova@"$CORDOVA_VERSION" cordova-res@"$CORDOVA_RES_VERSION" @ionic/cli@"$IONIC_CLI_VERSION" && \ - npm cache clear --force - -# Install source code -#RUN git config --global user.email "user.name@domain.com" && \ -# git config --global user.name "User Name" && \ -RUN git clone https://git.duniter.org/clients/cesium-grp/cesium.git && \ - cd cesium && \ - yarn install - -WORKDIR cesium +RUN apk update && \ + apk add ca-certificates wget curl git && \ + update-ca-certificates && \ + apk add --update python make g++ + +# create group and user cesium +RUN addgroup -S -g 1111 cesium && \ + adduser -SD -h /cesium -G cesium -u 1111 cesium +#RUN mkdir -p /var/lib/cesium /etc/cesium && chown cesium:cesium /var/lib/cesium /etc/cesium + +# Install global dependencies +RUN yarn global add gulp@"$GULP_VERSION" @ionic/cli@"$IONIC_CLI_VERSION" + +# copy source tree +COPY ./ ./ + +# Install project dependencies +# Workaround need for node-sass (- )see https://github.com/yarnpkg/yarn/issues/4867) +RUN yarn install --ignore-engines && \ + yarn remove node-sass && yarn add node-sass + +WORKDIR /cesium EXPOSE 8100 35729 CMD ["yarn", "run", "start"] diff --git a/package.json b/package.json index af880401..8795a741 100644 --- a/package.json +++ b/package.json @@ -144,7 +144,7 @@ "lazypipe": "^1.0.2", "merge2": "^1.3.0", "mv": "^2.1.1", - "node-sass": "^4.13.0", + "node-sass": "^4.13.1", "playup": "^1.1.0", "vinyl-fs": "^3.0.3", "yargs": "^5.0.0" @@ -223,4 +223,4 @@ "engines": { "yarn": ">= 1.0.0" } -} \ No newline at end of file +} diff --git a/scripts/docker-build.sh b/scripts/docker-build.sh new file mode 100755 index 00000000..15f15ac9 --- /dev/null +++ b/scripts/docker-build.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Get to the root project +if [[ "_" == "_${PROJECT_DIR}" ]]; then + SCRIPT_DIR=$(dirname $0) + PROJECT_DIR=$(cd ${SCRIPT_DIR}/.. && pwd) + export PROJECT_DIR +fi; + +cd ${PROJECT_DIR} + +CMD="sudo docker build ${PROJECT_DIR} -t cesium/release" +echo "Executing: $CMD" +$CMD diff --git a/scripts/docker-start.sh b/scripts/docker-start.sh index d9a1d171..367d4e80 100755 --- a/scripts/docker-start.sh +++ b/scripts/docker-start.sh @@ -9,7 +9,6 @@ fi; cd ${PROJECT_DIR} -PWD=$(pwd) -CMD="sudo docker run -ti --rm -p 8100:8100 -p 35729:35729 -v $PWD:/cesium:rw cesium:release" +CMD="sudo docker run -ti --rm -p 8100:8100 -p 35729:35729 -v ${PROJECT_DIR}:/cesium:rw cesium:release" echo "Executing: $CMD" $CMD diff --git a/scripts/env-android.sh b/scripts/env-android.sh index f929fa4e..ee6b932d 100755 --- a/scripts/env-android.sh +++ b/scripts/env-android.sh @@ -9,9 +9,7 @@ fi; # Preparing environment . ${PROJECT_DIR}/scripts/env-global.sh -if [[ $? -ne 0 ]]; then - exit 1 -fi +[[ $? -ne 0 ]] && exit 1 if [[ "_" == "_${CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL}" ]]; then echo "Missing Gradle distribution URL - please export env variable 'CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'" @@ -36,9 +34,7 @@ fi if [[ ! -d "${ANDROID_SDK_TOOLS_ROOT}" ]]; then cd "${PROJECT_DIR}/scripts" ./install-android-sdk-tools.sh - if [[ $? -ne 0 ]]; then - exit 1 - fi + [[ $? -ne 0 ]] && exit 1 fi # Install Gradle @@ -49,13 +45,9 @@ if [[ "_" == "_$(which gradle)" && ! -d "${GRADLE_HOME}" ]]; then GRADLE_PARENT=$(dirname $GRADLE_HOME) test -e "${GRADLE_PARENT}" || mkdir -p ${GRADLE_PARENT} test -e "${GRADLE_PARENT}/gradle-${GRADLE_VERSION}" || unzip -qq gradle-${GRADLE_VERSION}-all.zip -d "${GRADLE_PARENT}" - if [[ $? -ne 0 ]]; then - exit 1 - fi + [[ $? -ne 0 ]] && exit 1 test -e "${GRADLE_HOME}" || mv "${GRADLE_PARENT}/gradle-${GRADLE_VERSION}" "${GRADLE_HOME}" - if [[ $? -ne 0 ]]; then - exit 1 - fi + [[ $? -ne 0 ]] && exit 1 test -e "${GRADLE_PARENT}/gradle-${GRADLE_VERSION}" || rm "${GRADLE_PARENT}/gradle-${GRADLE_VERSION}" fi @@ -65,18 +57,14 @@ if [[ ! -d "${PROJECT_DIR}/platforms/android" ]]; then echo "Adding Cordova Android platform..." cd "${PROJECT_DIR}" ionic cordova prepare android --color --verbose - if [[ $? -ne 0 ]]; then - exit 1 - fi + [[ $? -ne 0 ]] && exit 1 fi # Copy local files if [[ -d "${PROJECT_DIR}/.local/android" ]]; then echo "Copying files from directory '${PROJECT_DIR}/.local/android' into '${PROJECT_DIR}/platforms/android'..." cp -rf ${PROJECT_DIR}/.local/android/* ${PROJECT_DIR}/platforms/android - if [[ $? -ne 0 ]]; then - exit 1 - fi + [[ $? -ne 0 ]] && exit 1 else echo "No directory '${PROJECT_DIR}/.local/android' found. Please create it, with a file 'release-signing.properties' for release signing" fi diff --git a/scripts/env-global.sh b/scripts/env-global.sh index 41642fbb..d136f1c4 100755 --- a/scripts/env-global.sh +++ b/scripts/env-global.sh @@ -95,9 +95,8 @@ if [[ ! -d "${ANDROID_SDK_ROOT}" ]]; then fi fi -# Export Android SDK tools to path -too=${ANDROID_SDK_ROOT}/tools -PATH=${ANDROID_SDK_TOOLS_ROOT}/bin:${GRADLE_HOME}/bin:$PATH +# Add Java, Android SDK tools to path +PATH=${ANDROID_SDK_TOOLS_ROOT}/bin:${GRADLE_HOME}/bin:${JAVA_HOME}/bin$:$PATH # Export useful variables export PATH \ @@ -121,9 +120,7 @@ if [[ -d "${NVM_DIR}" ]]; then # Or install it if [[ $? -ne 0 ]]; then nvm install ${NODEJS_VERSION} - if [[ $? -ne 0 ]]; then - exit 1; - fi + [[ $? -ne 0 ]] && exit 1 fi else echo "nvm (Node version manager) not found (directory ${NVM_DIR} not found). Please install, and retry" diff --git a/www/manifest.json b/www/manifest.json index 7151a961..3784a853 100644 --- a/www/manifest.json +++ b/www/manifest.json @@ -2,9 +2,9 @@ "short_name": "Cesium", "name": "Cesium", "manifest_version": 1, - "version": "1.6.2-alpha", + "version": "1.6.3", "default_locale": "fr", - "description": "Manage your Duniter Wallet on a libre currency, like Äž1", + "description": "Cesium Wallet for Äž1 libre currency", "icons": [ { "src": "img/logo_32px.png", -- GitLab