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 type: docker
name: docker-arm-release name: docker-arm-release
depends_on:
- release-latest
- release-version
platform: platform:
os: linux os: linux
arch: arm arch: arm
@ -304,12 +308,7 @@ trigger:
- "refs/tags/**" - "refs/tags/**"
steps: steps:
- name: fetch-tags - name: docker-latest
image: docker:git
commands:
- git fetch --tags
- name: docker
image: plugins/docker:linux-arm image: plugins/docker:linux-arm
pull: true pull: true
settings: settings:
@ -320,8 +319,30 @@ 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: build_args:
- fetch-tags - 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 kind: pipeline
@ -332,36 +353,17 @@ platform:
os: linux os: linux
arch: amd64 arch: amd64
depends_on:
- release-latest
- release-version
trigger: trigger:
ref: ref:
- refs/heads/master - refs/heads/master
- "refs/tags/**" - "refs/tags/**"
steps: steps:
- name: fetch-tags - name: docker-latest
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
image: plugins/docker:linux-amd64 image: plugins/docker:linux-amd64
pull: true pull: true
settings: settings:
@ -372,9 +374,30 @@ 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: build_args:
- fetch-tags - USE_RELEASE=true
- restore-cache - 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 kind: pipeline

View file

@ -3,10 +3,19 @@ FROM node:13.14.0 AS compile-image
WORKDIR /build WORKDIR /build
ARG USE_RELEASE=false
ARG RELEASE_VERSION=master
ENV YARN_CACHE_FOLDER .cache/yarn/ ENV YARN_CACHE_FOLDER .cache/yarn/
COPY . ./ COPY . ./
RUN \ 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 # Build the frontend
yarn install --frozen-lockfile --network-timeout 100000 && \ 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 && \ echo '{"VERSION": "'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'"}' > src/version.json && \