From 35ab332535c2686efbe501e51fb7a5973a76b2e2 Mon Sep 17 00:00:00 2001 From: Kavelach Date: Mon, 14 Jun 2021 13:05:57 +0200 Subject: [PATCH] =?UTF-8?q?Cache=20npm=20dzielony=20mi=C4=99dzy=20kontener?= =?UTF-8?q?ami=20dockera?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Ref T2306 Test Plan: Odpalić budowanie apki bez i z cachem. Apka z cachem powinna zbudować się dużo szybciej. Reviewers: #reviewers, kuba-orlik Reviewed By: #reviewers, kuba-orlik Subscribers: jenkins-user Maniphest Tasks: T2306 Differential Revision: https://hub.sealcode.org/D1085 --- docker-compose.yml | 3 ++- jenkins.prepare.sh | 7 +++++++ jenkins.start.sh | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 939f1ce..a99c83f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,9 +11,10 @@ services: dockerfile: test.Dockerfile volumes: - ./:/opt/sealious/ + - ~/.npm_cacache:/opt/sealious/.npm_cacache user: ${UID:-1000}:${GID:-1000} mailcatcher: image: schickling/mailcatcher:latest ports: - "127.0.0.1:1080:1080" - - "127.0.0.1:1025:1025" \ No newline at end of file + - "127.0.0.1:1025:1025" diff --git a/jenkins.prepare.sh b/jenkins.prepare.sh index cd0e390..839e120 100755 --- a/jenkins.prepare.sh +++ b/jenkins.prepare.sh @@ -11,6 +11,13 @@ export SEALIOUS_PORT=$PORT SEALIOUS_BASE_URL=$(cat .base_url) export SEALIOUS_BASE_URL +# Create the npm cache directory if it isn't present yet. If it is not present, it will be created +# when the docker image is being built with root:root as the owner. +mkdir -p ~/.npm_cacache +# Create .npm directory in the container, since it is not yet present and we need it for next step. +docker-compose run --user="$UID" --rm --service-ports test mkdir -p /opt/sealious/.npm +# Link the host-bound npm cache directory into the container's npm cache directory. +docker-compose run --user="$UID" --rm --service-ports test ln -s /opt/sealious/.npm_cacache /opt/sealious/.npm/_cacache docker-compose up -d db ./npm.sh ci ./npm.sh run build:back; diff --git a/jenkins.start.sh b/jenkins.start.sh index 6a08254..e19de74 100755 --- a/jenkins.start.sh +++ b/jenkins.start.sh @@ -18,5 +18,5 @@ docker-compose run --user="$UID"\ && echo "App started on $SEALIOUS_PORT" -echo "Deployed to https://${PORT}.dep.sealco.de" -echo "Application logs should be available at https://jenkins.sealcode.org/job/Deploy%20to%20dep.sealco.de/ws/$PORT/log.html" +echo "Deployed to https://${PORT}.dep.sealco.de" +echo "Application logs should be available at https://jenkins.sealcode.org/job/Deploy%20to%20dep.sealco.de/ws v2/$PORT/log.html"