forked from Arelle/ixbrl-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
78 lines (55 loc) · 2.03 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
FROM node:19-slim as node-build
ARG NPM_CONFIG__AUTH
ARG NPM_CONFIG_REGISTRY=https://workivaeast.jfrog.io/workivaeast/api/npm/npm-prod/
ARG NPM_CONFIG_ALWAYS_AUTH=true
ARG GIT_TAG
RUN reg=$(echo "$NPM_CONFIG_REGISTRY" | cut -d ":" -f 2) && \
echo "$reg:_auth = $NPM_CONFIG__AUTH" > /.npmrc && \
echo "registry = $NPM_CONFIG_REGISTRY" >> /.npmrc && \
echo "always-auth = true" >> /.npmrc
ARG NPM_CONFIG_USERCONFIG=/.npmrc
WORKDIR /build/
COPY package.json /build/
RUN npm install --include=dev
COPY . /build/
# The following command replaces the version string in package.json
ARG VERSION=${GIT_TAG:-0.0.0}
RUN sed -i "s/\"version\": \"0\.0\.0\"/\"version\": \"$VERSION\"/" package.json
# lint check .less files
RUN npm run stylelint
# javascript tests
RUN npm run test
# build ixbrlviewer.js
RUN npm run prod
# Upload ixbrlviewer.js to github artifacts
ARG BUILD_ARTIFACTS_GITHUB_RELEASE_ASSETS=/build/iXBRLViewerPlugin/viewer/dist/ixbrlviewer.js
# Host ixviewer.js on CDN
RUN mkdir /static_release
RUN tar -czf /static_release/assets.tar.gz -C /build/iXBRLViewerPlugin/viewer/dist/ .
ARG BUILD_ARTIFACTS_CDN=/static_release/assets.tar.gz
# npm package creation
RUN npm pack
ARG BUILD_ARTIFACTS_NPM=/build/*.tgz
FROM python:3.9-slim as python-build
ARG PIP_INDEX_URL
ARG GIT_TAG
WORKDIR /build/
COPY requirements*.txt /build/
RUN pip install -U pip setuptools && \
pip install -r requirements-dev.txt
COPY . /build/
COPY --from=node-build /build/iXBRLViewerPlugin/viewer/dist /build/iXBRLViewerPlugin/viewer/dist
# The following command replaces the version string in setup.py
ARG VERSION=${GIT_TAG:-0.0.0}
RUN sed -i "s/version='0\.0\.0'/version='$VERSION'/" setup.py
# python tests
ARG BUILD_ARTIFACTS_TEST=/test_reports/*.xml
RUN mkdir /test_reports
RUN nose2 --plugin nose2.plugins.junitxml --junit-xml-path ../test_reports/results.xml
# pypi package creation
ARG BUILD_ARTIFACTS_PYPI=/build/dist/*.tar.gz
RUN python setup.py sdist
ARG BUILD_ARTIFACTS_AUDIT=/audit/*
RUN mkdir /audit/
RUN pip freeze > /audit/pip.lock
FROM scratch