Cache npm dzielony między kontenerami dockera

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
master
Kavelach 3 years ago
parent dd8e14ab0c
commit 35ab332535

@ -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"
- "127.0.0.1:1025:1025"

@ -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;

@ -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"

Loading…
Cancel
Save