From c778c87f00e0b927ab9356644abf3b2bffc15cec Mon Sep 17 00:00:00 2001 From: Robin Bourianes Date: Fri, 24 May 2024 11:37:00 +0200 Subject: [PATCH] wip: removed travis CI, updated dockerignore, rmoved old dockerfile --- .dockerignore | 9 --- .travis.app.sh | 126 ------------------------------------ .travis.yml | 24 ------- app.Dockerfile.dockerignore | 5 ++ dockerfile | 39 ----------- 5 files changed, 5 insertions(+), 198 deletions(-) delete mode 100644 .dockerignore delete mode 100644 .travis.app.sh delete mode 100644 .travis.yml delete mode 100644 dockerfile diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index c6681d73..00000000 --- a/.dockerignore +++ /dev/null @@ -1,9 +0,0 @@ -.git -.quasar -node_modules -dist -src-cordova -api/node_modules -api/dist -api/logs -benchmark diff --git a/.travis.app.sh b/.travis.app.sh deleted file mode 100644 index f148a7cf..00000000 --- a/.travis.app.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash - -check_code() -{ - if [[ $1 -ne $2 ]]; then - echo "$3 has failed [error: $1]" - exit 1 - fi -} - -parse_semver() -{ - local REGEXP="^([0-9]+)\.([0-9]+)\.([0-9]+)" - [[ "$1" =~ $REGEXP ]] - SEMVER=(${BASH_REMATCH[1]} ${BASH_REMATCH[2]} ${BASH_REMATCH[3]}) -} - -# -# Provision the required files -# -travis_fold start "provision" - -# Define the application name -APP=$(node -p -e "require('./package.json').name") - -# Define the application version -VERSION=$(node -p -e "require('./package.json').version") -parse_semver $VERSION -MAJOR=${SEMVER[0]} -MINOR=${SEMVER[1]} -PATCH=${SEMVER[2]} - -echo "Building $APP v$MAJOR.$MINOR.$PATCH" - -# Define the flavor build -TEST_FLAVOR_REGEX="^test-*|-test$" -PROD_FLAVOR_REGEX="^prod-v[0-9]+\.[0-9]+\.[0-9]+" -if [[ $TRAVIS_TAG =~ $PROD_FLAVOR_REGEX ]]; -then - export FLAVOR=prod - KLI_FILE=$APP-$VERSION -else - if [[ $TRAVIS_BRANCH =~ $TEST_FLAVOR_REGEX ]]; - then - export FLAVOR=test - KLI_FILE=$APP-$MAJOR.$MINOR - else - export FLAVOR=dev - KLI_FILE=$APP - fi -fi -export NODE_APP_INSTANCE=$FLAVOR -TAG=$VERSION-$FLAVOR - -echo "Build flavor is $FLAVOR on branch $TRAVIS_BRANCH" - -# Leave the project directory to avoid Webpack to look for files into the project directory -cd .. - -# Clone the workspace where to build the app -git clone https://oauth2:$GITHUB_TOKEN@github.com/kalisio/development.git -export WORKSPACE_DIR=`pwd`/development/workspaces/apps - -# Configure the required env -source $WORKSPACE_DIR/apps.sh $APP -export BUILD_NUMBER=$TRAVIS_BUILD_NUMBER - -# Install the kli -git clone https://github.com/kalisio/kli.git kalisio && cd kalisio && yarn - -# In dev flavor we can build different versions on different branches -# so check if a specific file exists for the target branch first otherwise use default one -if [[ -f $WORKSPACE_DIR/$APP/$FLAVOR/$KLI_FILE-$TRAVIS_BRANCH.js ]]; -then - cp $WORKSPACE_DIR/$APP/$FLAVOR/$KLI_FILE-$TRAVIS_BRANCH.js $APP.js -else - cp $WORKSPACE_DIR/$APP/$FLAVOR/$KLI_FILE.js $APP.js -fi - -# Clone the project and install the dependencies -node . $APP.js --clone -node . $APP.js --install -node . $APP.js --link - -travis_fold end "provision" - -# -# Build the app -# -travis_fold start "build" - -cd $APP -yarn pwa:build -EXIT_CODE=$? -check_code $EXIT_CODE 0 "Builing the client" - -# Log in to docker before building the app because of rate limiting -docker login -u="$DOCKER_USER" -p="$DOCKER_PASSWORD" -check_code $? 0 "Connecting to Docker" - -# Create an archive to speed docker build process -cd ../.. -tar --exclude='$APP/test' -zcf $TRAVIS_BUILD_DIR/kalisio.tgz kalisio - -# Build the image -cd $TRAVIS_BUILD_DIR -docker build --build-arg APP=$APP --build-arg FLAVOR=$FLAVOR --build-arg BUILD_NUMBER=$BUILD_NUMBER -f dockerfile -t kalisio/$APP:$TAG . -check_code $? 0 "Building the app docker image" - -travis_fold end "build" - -# -# Deploy the app -# -travis_fold start "deploy" - -# Push the app image to the hub with the version tag -docker push kalisio/$APP:$TAG -check_code $? 0 "Pushing the $APP:$TAG docker image" - -# Push the app image to the hub with the flavor tag -docker tag kalisio/$APP:$TAG kalisio/$APP:$FLAVOR -docker push kalisio/$APP:$FLAVOR -check_code $? 0 "Pushing the $APP:$TAG docker image" - -travis_fold end "deploy" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0112f62a..00000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -notifications: - email: false - slack: - rooms: - secure: l0Hmj4Fxy0JAEqBP/dFeTqOxqK/bhvp1fup9scagPEBmgqV2X7ZKPgNcsfUj1XcjtboYX7VTskqxgV9HXaWOuQouuPVt1rb1XssAziiDtLZBDx9Rw54gg7AHprXh/Um3C4HF63TYvCGb3pC53iatT/vEo1QBTl2GSzqa7X6pKeryAe6nHmVRQN2WGiebI+ysjpXgzkfG0N1jzGzFDWnbiiEyx9T29aodFyxH8dFSxrbF0igdPbp1ALz8k8YpQzKkkjVIGsI4W6sPl1OqqjndCcBSX+Qr6HgJqgVd/78P8k9GA4v+p3lyXTydxT2pL4ti1x+TWHv4eABZQ7sCOzFrrI2YJKxgyAqft5ewmjD1feiF9PisHbTMu0hlXYkXeONZRVy0QtwKNGjiYQXKA55QlnDIpXtRLyrNabiYNNQAH+z8ToGGtZmTvyIn0+3PQRNpQaHWWnY1gyU8j8IHs8K1k7M64ngcrda+f8W2Bvs23PrHYXyChV2l5KZtGC2HuKz6XWgQpBNcDbB92iL4ElRvtHR9U48tOpZivtYNlVALTU6L63tZ647l8taxIJG6LMP3I0xmkEolin/vhygTfKLg2f8lGhawnDoTUVGV6hTC8NI/MfjsbIS/j+UKcipjWeNUng0qRHFRf1hvMFKPwKSGwO644gnnyABED1T4dccP5EE= - on_success: always - on_failure: always -stages: -- name: APP - if: commit_message !~ /(skip[ _-]app)/ -jobs: - include: - - stage: APP - os: linux - language: node_js - node_js: - - '16' - services: - - docker - install: skip - before_script: - - export -f travis_fold - script: - - bash .travis.app.sh diff --git a/app.Dockerfile.dockerignore b/app.Dockerfile.dockerignore index 91702018..c2dfd1ea 100644 --- a/app.Dockerfile.dockerignore +++ b/app.Dockerfile.dockerignore @@ -6,10 +6,15 @@ # Ignore all these development/* +benchmark/* **/node_modules +**/dist +**/src-cordova +**/logs **/npm-debug.log **/*Dockerfile **/docker-compose* **/*dockerignore **/.git **/.gitignore +**/.quasar diff --git a/dockerfile b/dockerfile deleted file mode 100644 index 69a02f6f..00000000 --- a/dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -FROM node:16-bullseye-slim as Builder -LABEL maintainer="contact@kalisio.xyz" - -ARG FLAVOR -ARG BUILD_NUMBER - -ENV BUILD_NUMBER=$BUILD_NUMBER -ENV NODE_APP_INSTANCE=$FLAVOR - -# Copy the built artefact. -# Warning - -# We could do ADD and let Docker uncompress automatically the archive but we reach log limit in Travis. -# So we copy the archive and uncompress it using tar without the verbose mode -COPY kalisio.tgz /opt/. -WORKDIR /opt -RUN tar zxf kalisio.tgz && rm kalisio.tgz - -# Link the modules and run the app -# Use multisage build to forget the unused archive.tgz -FROM node:16-bullseye-slim -LABEL maintainer="contact@kalisio.xyz" - -ARG APP -ARG FLAVOR -ARG BUILD_NUMBER - -ENV BUILD_NUMBER=$BUILD_NUMBER -ENV NODE_APP_INSTANCE=$FLAVOR - -COPY --from=Builder /opt/kalisio /opt/kalisio - -# Link the modules -WORKDIR /opt/kalisio -RUN node . ${APP}.js --link - -# Run the app -WORKDIR /opt/kalisio/${APP} -EXPOSE 8081 -CMD [ "yarn", "prod" ]