Skip to content
Snippets Groups Projects
Commit 9642f87c authored by FERNANDES SAMUEL's avatar FERNANDES SAMUEL :star:
Browse files

Merge branch 'feat-better-pipeline' into 'develop'

Resolve "Better pipeline"

See merge request the-sevens/the-sevens!64
parents a9d5ec11 709b874c
Branches
Tags
No related merge requests found
image: ubuntu
stages:
- build
- deploy
# tests are obsolet, no time to update, so forgot them
build:
stage: build
script:
- apt-get update && apt-get install -y zip
- zip -r builds.zip . -x "*.git*"
artifacts:
paths:
- builds.zip
expire_in: 1h
only:
- release
deploy-backend:
stage: deploy
rules:
- if: '$CI_COMMIT_REF_NAME == "release"'
# use vite preview (because SSR not allowed of Pages) for 'staging'-like tests
script:
- apt-get update && apt-get install -y openssh-client sshpass
- apt-get update && apt-get install -y openssh-client
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan $VM_IPADDRESS >> ~/.ssh/known_hosts
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'sudo chmod -R 777 ~/the-sevens/'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'sudo docker compose -f ~/the-sevens/docker-compose.yml down || true'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'rm -rf ~/the-sevens || true'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'git clone https://$ACCESS_TOKEN_NAME:$ACCESS_TOKEN_VALUE@$PROJECT_URL ~/the-sevens'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'sudo chmod -R 777 ~/the-sevens/'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'sudo chmod 777 ~/.env || true'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'git -C ~/the-sevens add -A || true'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'git -C ~/the-sevens stash || true'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'git -C ~/the-sevens stash clear || true'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'git -C ~/the-sevens fetch origin release || true'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'git -C ~/the-sevens switch release || true'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'sudo rm -rf ~/the-sevens/QuizzMobile || true'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'cp ~/.env ~/the-sevens/'"
- sshpass -p $SSH_MDP ssh -tt $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'source ~/.nvm/nvm.sh && cd ~/the-sevens/ZmeiApi && yarn install || true'"
- sshpass -p $SSH_MDP ssh -tt $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'source ~/.nvm/nvm.sh && cd ~/the-sevens/QuizzWeb && yarn install || true'"
- sshpass -p $SSH_MDP ssh -t $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'sudo docker compose -f ~/the-sevens/docker-compose.yml up -d --build --remove-orphans || true'"
- scp -i ~/.ssh/id_rsa builds.zip $SSH_USER@$VM_IPADDRESS:~/
- ssh -i ~/.ssh/id_rsa $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'sudo ./cleaner.sh'"
- ssh -i ~/.ssh/id_rsa $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'sudo rm -rf the-sevens/'"
- ssh -i ~/.ssh/id_rsa $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'unzip -o ~/builds.zip -d ~/the-sevens/'"
- ssh -i ~/.ssh/id_rsa $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'rm ~/builds.zip'"
- ssh -i ~/.ssh/id_rsa $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'cp ~/.env ~/the-sevens/.env'"
- ssh -i ~/.ssh/id_rsa $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'sudo docker compose -f ~/the-sevens/docker-compose.yml down || true'"
- ssh -i ~/.ssh/id_rsa $SSH_USER@$VM_IPADDRESS "/usr/bin/bash -c 'sudo docker compose -f ~/the-sevens/docker-compose.yml up -d --build --remove-orphans --build || true'"
only:
- release
......@@ -6,11 +6,13 @@ RUN apt-get -y update && apt-get -y install postgresql
WORKDIR /colossus
COPY package.json yarn.lock ./
RUN yarn install
COPY . .
RUN yarn generate
# RUN rm -rf /tmp/tsx-0
RUN yarn build
EXPOSE 2728
......
......@@ -5,11 +5,11 @@ services:
volumes:
- ./QuizzWeb:/colossus
- /colossus/node_modules
- /colossus/dist
- /colossus/build
container_name: kwizos
network_mode: "host"
environment:
- ENV VITE_API_URL="http://{VITE_API_URL}:2728"
- VITE_API_URL="http://{VITE_API_URL}:2728"
api:
build:
......@@ -17,12 +17,24 @@ services:
volumes:
- ./ZmeiApi:/colossus
- /colossus/node_modules
- /colossus/dist
environment:
- TRANSACTION_URL=${TRANSACTION_URL}
- SESSION_URL=${SESSION_URL}
- SUPABASE_PROJECT_URL=${SUPABASE_PROJECT_URL}
- SUPABASE_PROJECT_KEY=${SUPABASE_PROJECT_KEY}
- JWT_SECRET=${JWT_SECRET}
- NODE_ENV=${NODE_ENV}
- PORT=${PORT}
- HOST=${HOST}
- CORS_ORIGIN=${CORS_ORIGIN}
- COMMON_RATE_LIMIT_WINDOW_MS=${COMMON_RATE_LIMIT_WINDOW_MS}
- COMMON_RATE_LIMIT_MAX_REQUESTS=${COMMON_RATE_LIMIT_MAX_REQUESTS}
- UPLOAD_DIR=${UPLOAD_DIR}
container_name: api
network_mode: "host"
ollama:
container_name: ollama
network_mode: "host"
command: ["ollama", "serve", "||", "true"]
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