diff --git a/.build/nginx.conf b/.build/nginx.conf new file mode 100644 index 0000000..a72d2a8 --- /dev/null +++ b/.build/nginx.conf @@ -0,0 +1,31 @@ +user www-data; +worker_processes 1; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; +events { + worker_connections 1024; +} +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + log_format main '$remote_addr - $remote_user [$time_local]' + '"$request" $status $body_bytes_sent' + '"$http_referer" "$http_user_agent"' + '"$http_x_forwarded_for"'; + access_log /var/log/nginx/access.log main; + + server { + + listen 80 default_server; + listen [::]:80 default_server; + charset utf-8; + + etag on; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri.html $uri/ /index.html =404; + } + } +} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 05ff13e..67b3408 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,148 +1,35 @@ stages: - - test - build + - deploy -eslint: - image: node:10.15 - stage: test - script: - - npm i - - npm run lint - only: - - merge_requests - - master - - develop - tags: - - docker - -tests: - image: node:10.15 - stage: test - script: - - npm i - - npm run build - - npm run test - only: - - merge_requests - - master - - develop - tags: - - docker - -build.develop: - stage: build - cache: - key: $CI_COMMIT_REF_NAME - paths: - - node_modules - script: - - npm config set unsafe-perm true - - rm -rf node_modules/node-sass - - npm i - - npm run build-web - - rm -rf /home/frontend - - cp -r ./dist /home/frontend - only: - - develop - tags: - - develop - environment: - name: development - -build.master: - stage: build - cache: - key: $CI_COMMIT_REF_NAME - paths: - - node_modules - script: - - npm config set unsafe-perm true - - rm -rf node_modules/node-sass - - npm i - - npm run build-web - - rm -rf /home/frontend - - cp -r ./dist /home/frontend - only: - - master - tags: - - stage - environment: - name: development - -build.package-linux: - image: electronuserland/builder:10 +build: stage: build variables: - DOWNLOAD_ECHO_NODE_URL: "https://github.com/echoprotocol/echo/releases/download/0.6.1/echo_node" - cache: - key: $CI_COMMIT_REF_NAME - paths: - - node_modules + NODE_APP_INSTANCE: $CI_COMMIT_REF_NAME + before_script: + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY script: - - npm config set unsafe-perm true - - rm -rf node_modules/node-sass - - npm i - - DEBUG_PROD=true npm run package-linux + - docker build --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME . + - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME only: - master - develop tags: - - docker - artifacts: - name: 'artifacts_linux_$CI_COMMIT_REF_NAME' - paths: - - release/*.deb - - release/*.rpm - expire_in: 1 week - environment: - name: development + - echo-linux -build.package-win: - image: electronuserland/builder:wine - stage: build - cache: - key: "win_$CI_COMMIT_REF_NAME" - paths: - - node_modules +deploy: + stage: deploy + before_script: + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - if [ "$CI_COMMIT_REF_NAME" != "master" ]; then export PORT=36640; fi + variables: + CI_COMMIT_REF_NAME: develop + CI_FULL_REGISTRY: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME + PORT: 26640 script: - - npm config set unsafe-perm true - - rm -rf node_modules/node-sass - - npm i - - DEBUG_PROD=true npm run package-win + - docker-compose -p "blip-${CI_COMMIT_REF_NAME}" up -d only: - - master - develop - tags: - - docker - artifacts: - name: 'artifacts_win_$CI_COMMIT_REF_NAME' - paths: - - release/*.exe - - release/*.msi - expire_in: 1 week - environment: - name: development - -build.package-mac: - stage: build -# cache: -# key: $CI_COMMIT_REF_NAME -# paths: -# - node_modules - script: - - npm config set unsafe-perm true - - npm i - - DEBUG_PROD=true npm run package-mac - only: - master - - develop tags: - - echo-mac - artifacts: - name: 'artifacts_mac_$CI_COMMIT_REF_NAME' - paths: - - release/*.dmg - - release/*.zip - expire_in: 1 week - environment: - name: development + - echo-linux diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..cd0045e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,94 @@ +sudo: required +language: node_js +node_js: + - "10" +install: + - NODE_ENV=development npm i yarn + + + +env: + global: + - NODE_OPTIONS="--max-old-space-size=2048" + - NODE_ENV="development" + +stages: + - test + - build + +jobs: + include: + + - stage: test + name: "Test" + if: type = push + script: + - NODE_ENV=development npm install + - npm run build + - npm run test + - npm run lint + + + + + - stage: build + name: "Build Linux App" + env: + - DOWNLOAD_ECHO_NODE_URL= "https://github.com/echoprotocol/echo/releases/download/0.6.1/echo_node" + if: tag IS present + script: + - sudo apt-get install rpm + - npm config set unsafe-perm true + - rm -rf node_modules/node-sass + - npm i + - DEBUG_PROD=true npm run package-linux + deploy: + provider: releases + api_key: $GITHUB_OAUTH_TOKEN + file_glob: true + file: + - release/*.deb + - release/*.rpm + skip_cleanup: true + on: + tags: true + + + - stage: build + name: "Build Win App" + if: tag IS present + script: + - npm config set unsafe-perm true + - rm -rf node_modules/node-sass + - "docker run --rm -v ${PWD}:/project -v ${PWD}/.cache/electron:/root/.cache/electron -v ${PWD}/.cache/electron-builder:/root/.cache/electron-builder electronuserland/builder:wine /bin/bash -c \"npm install && npm run package-win\"" + - ls -la release/ + deploy: + provider: releases + api_key: $GITHUB_OAUTH_TOKEN + file_glob: true + file: + - release/*.exe + - release/*.msi + skip_cleanup: true + on: + tags: true + + + - stage: build + os: osx + name: "Build macOS App" + if: tag IS present + script: + - npm config set unsafe-perm true + - npm i + - DEBUG_PROD=true npm run package-mac + deploy: + provider: releases + api_key: $GITHUB_OAUTH_TOKEN + file_glob: true + file: + - release/*.dmg + - release/*.zip + skip_cleanup: true + on: + tags: true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a3df5a5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM node:10.16.1-alpine as builder + +RUN apk add --update-cache git python make g++ gcc libpng-dev automake libtool + +WORKDIR /app/ + +COPY package.json ./ + +RUN npm config set unsafe-perm true +COPY . . +RUN npm i +RUN npm run build-web + +FROM nginx:stable + +RUN rm -rf /usr/share/nginx/html +COPY --from=builder /app/dist /usr/share/nginx/html +COPY .build/nginx.conf /etc/nginx/nginx.conf + +WORKDIR /etc/nginx + +CMD ["nginx", "-g", "daemon off;"] diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b03dcfa..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,38 +0,0 @@ -image: Visual Studio 2017 - -platform: - - x64 - -environment: - matrix: - - nodejs_version: 10 - -cache: - - '%LOCALAPPDATA%/Yarn' - - node_modules - - flow-typed - - '%USERPROFILE%\.electron' - -matrix: - fast_finish: true - -build: off - -version: '{build}' - -shallow_clone: true - -clone_depth: 1 - -install: - - ps: Install-Product node $env:nodejs_version x64 - - set CI=true - - yarn - -test_script: - - yarn package-ci - - yarn lint - # - yarn flow - - yarn test - - yarn build-e2e - - yarn test-e2e diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4ca54f2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3' + +services: + + blip-wallet: + image: $CI_FULL_REGISTRY + ports: + - 127.0.0.1:${PORT}:80 + restart: always