Use yarn caches when building docker images

This commit is contained in:
kolaente 2020-12-10 15:46:51 +01:00
parent 0ca9862ffe
commit 6b0edd2d9a
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 47 additions and 4 deletions

View file

@ -163,7 +163,7 @@ steps:
pull: true pull: true
group: build-static group: build-static
environment: environment:
YARN_CACHE_FOLDER: .cache YARN_CACHE_FOLDER: .cache/yarn/
commands: commands:
- yarn --frozen-lockfile --network-timeout 100000 - yarn --frozen-lockfile --network-timeout 100000
- yarn run lint - yarn run lint
@ -233,7 +233,7 @@ steps:
pull: true pull: true
group: build-static group: build-static
environment: environment:
YARN_CACHE_FOLDER: .cache YARN_CACHE_FOLDER: .cache/yarn/
commands: commands:
- yarn --frozen-lockfile --network-timeout 100000 - yarn --frozen-lockfile --network-timeout 100000
- yarn run lint - yarn run lint
@ -308,6 +308,25 @@ steps:
image: docker:git image: docker:git
commands: commands:
- git fetch --tags - git fetch --tags
- name: restore-cache
image: meltwater/drone-cache:dev
pull: true
environment:
AWS_ACCESS_KEY_ID:
from_secret: cache_aws_access_key_id
AWS_SECRET_ACCESS_KEY:
from_secret: cache_aws_secret_access_key
settings:
restore: true
bucket: kolaente.dev-drone-dependency-cache
endpoint: https://s3.fr-par.scw.cloud
region: fr-par
path_style: true
cache_key: '{{ .Repo.Name }}_{{ checksum "yarn.lock" }}_{{ arch }}_{{ os }}'
mount:
- '.cache'
- name: docker - name: docker
image: plugins/docker:linux-arm image: plugins/docker:linux-arm
pull: true pull: true
@ -319,7 +338,9 @@ steps:
repo: vikunja/frontend repo: vikunja/frontend
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm auto_tag_suffix: linux-arm
depends_on: [ fetch-tags ] depends_on:
- fetch-tags
- restore-cache
--- ---
kind: pipeline kind: pipeline
@ -340,6 +361,25 @@ steps:
image: docker:git image: docker:git
commands: commands:
- git fetch --tags - git fetch --tags
- name: restore-cache
image: meltwater/drone-cache:dev
pull: true
environment:
AWS_ACCESS_KEY_ID:
from_secret: cache_aws_access_key_id
AWS_SECRET_ACCESS_KEY:
from_secret: cache_aws_secret_access_key
settings:
restore: true
bucket: kolaente.dev-drone-dependency-cache
endpoint: https://s3.fr-par.scw.cloud
region: fr-par
path_style: true
cache_key: '{{ .Repo.Name }}_{{ checksum "yarn.lock" }}_{{ arch }}_{{ os }}'
mount:
- '.cache'
- name: docker - name: docker
image: plugins/docker:linux-amd64 image: plugins/docker:linux-amd64
pull: true pull: true
@ -351,7 +391,9 @@ steps:
repo: vikunja/frontend repo: vikunja/frontend
auto_tag: true auto_tag: true
auto_tag_suffix: linux-amd64 auto_tag_suffix: linux-amd64
depends_on: [ fetch-tags ] depends_on:
- fetch-tags
- restore-cache
--- ---
kind: pipeline kind: pipeline

View file

@ -3,6 +3,7 @@ FROM node:13.14.0 AS compile-image
WORKDIR /build WORKDIR /build
ENV YARN_CACHE_FOLDER .cache/yarn/
COPY . ./ COPY . ./
RUN \ RUN \