Add downloading assets when building docker images

This commit is contained in:
kolaente 2020-12-16 20:23:38 +01:00
parent 66d4738ec5
commit 3346fe00eb
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 67 additions and 35 deletions

View file

@ -294,6 +294,10 @@ kind: pipeline
type: docker
name: docker-arm-release
depends_on:
- release-latest
- release-version
platform:
os: linux
arch: arm
@ -304,12 +308,7 @@ trigger:
- "refs/tags/**"
steps:
- name: fetch-tags
image: docker:git
commands:
- git fetch --tags
- name: docker
- name: docker-latest
image: plugins/docker:linux-arm
pull: true
settings:
@ -320,8 +319,30 @@ steps:
repo: vikunja/frontend
auto_tag: true
auto_tag_suffix: linux-arm
depends_on:
- fetch-tags
build_args:
- USE_RELEASE=true
- RELEASE_VERSION=master
when:
ref:
- refs/heads/master
- name: docker-version
image: plugins/docker:linux-arm
pull: true
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/frontend
auto_tag: true
auto_tag_suffix: linux-arm
build_args:
- USE_RELEASE=true
- RELEASE_VERSION=${DRONE_TAG##v}
when:
ref:
- "refs/tags/**"
---
kind: pipeline
@ -332,36 +353,17 @@ platform:
os: linux
arch: amd64
depends_on:
- release-latest
- release-version
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
steps:
- name: fetch-tags
image: docker:git
commands:
- 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-latest
image: plugins/docker:linux-amd64
pull: true
settings:
@ -372,9 +374,30 @@ steps:
repo: vikunja/frontend
auto_tag: true
auto_tag_suffix: linux-amd64
depends_on:
- fetch-tags
- restore-cache
build_args:
- USE_RELEASE=true
- RELEASE_VERSION=master
when:
ref:
- refs/heads/master
- name: docker-version
image: plugins/docker:linux-amd64
pull: true
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/frontend
auto_tag: true
auto_tag_suffix: linux-amd64
build_args:
- USE_RELEASE=true
- RELEASE_VERSION=${DRONE_TAG##v}
when:
ref:
- "refs/tags/**"
---
kind: pipeline

View file

@ -3,10 +3,19 @@ FROM node:13.14.0 AS compile-image
WORKDIR /build
ARG USE_RELEASE=false
ARG RELEASE_VERSION=master
ENV YARN_CACHE_FOLDER .cache/yarn/
COPY . ./
RUN \
if [ $USE_RELEASE ]; then \
rm -rf dist/ && \
wget https://dl.vikunja.io/frontend/vikunja-frontend-$RELEASE_VERSION.zip -O frontend-release.zip && \
unzip frontend-release.zip -d dist/ && \
exit 0; \
fi && \
# Build the frontend
yarn install --frozen-lockfile --network-timeout 100000 && \
echo '{"VERSION": "'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'"}' > src/version.json && \