mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 12:01:57 +08:00
feat: Push docker image github package registry. (#1014)
* feat: Push docker image github package registry. * Docker image in Github Package * change npm ci to npm i * Add docker file. * remove docs lock files
This commit is contained in:
parent
c688bd042c
commit
14f833ab87
7
.github/workflows/docs.yml
vendored
7
.github/workflows/docs.yml
vendored
@ -19,6 +19,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
# This workflow contains a single job called "build"
|
# This workflow contains a single job called "build"
|
||||||
build:
|
build:
|
||||||
|
name: Build and deploy ADempiere-Vue docs
|
||||||
# The type of runner that the job will run on
|
# The type of runner that the job will run on
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@ -28,9 +29,11 @@ jobs:
|
|||||||
|
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: actions/setup-node@v1
|
- name: Node configuration
|
||||||
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
175
.github/workflows/publish.yml
vendored
175
.github/workflows/publish.yml
vendored
@ -6,47 +6,168 @@ name: Publish Project
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types:
|
||||||
|
- created
|
||||||
|
- edited
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
|
||||||
|
# Build dist application ADempiere-Vue
|
||||||
|
build-app:
|
||||||
|
name: Build dist ADempiere-Vue
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [10.x, 12.x, 13.x, 14.x]
|
node-version: [12.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Check out the repo
|
||||||
- uses: actions/setup-node@v1
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Node configuration
|
||||||
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
- run: npm i
|
cache: 'npm'
|
||||||
- run: npm test
|
|
||||||
- run: npm run build:prod --if-present
|
|
||||||
- run: set -e
|
|
||||||
- run: |
|
|
||||||
cd docs
|
|
||||||
npm i
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
publish-dist:
|
- name: Set tag version into config file
|
||||||
needs: build
|
run: sed -i "s|releaseNoForDocumentation|${{ github.event.release.tag_name }}|g" config/default.json
|
||||||
|
- name: Install packages
|
||||||
|
run: npm ci
|
||||||
|
- name: Run test
|
||||||
|
run: npm test
|
||||||
|
- name: Compile dist
|
||||||
|
run: npm run build:prod --if-present
|
||||||
|
|
||||||
|
- name: Upload dist app
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: adempiere-vue
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
|
||||||
|
# Publish dist binaries to application
|
||||||
|
publish-app-dist:
|
||||||
|
name: Upload ADempiere-Vue binaries
|
||||||
|
needs:
|
||||||
|
- build-app
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Download build dist app
|
||||||
- uses: actions/setup-node@v1
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
node-version: 12
|
name: adempiere-vue
|
||||||
registry-url: https://registry.npmjs.org/
|
|
||||||
- run: npm i
|
- name: Compress files for application dist
|
||||||
- run: sed -i "s|releaseNoForDocumentation|${{ github.event.release.tag_name }}|g" config/default.json
|
uses: TheDoctor0/zip-release@0.6.0
|
||||||
- run: npm run build:prod --if-present
|
|
||||||
- uses: TheDoctor0/zip-release@0.4.1
|
|
||||||
with:
|
with:
|
||||||
filename: 'Adempiere-Vue.zip'
|
filename: 'Adempiere-Vue.zip'
|
||||||
path: 'dist/'
|
path: './'
|
||||||
- uses: skx/github-action-publish-binaries@master
|
|
||||||
|
- name: Publish application binary in repository
|
||||||
|
uses: skx/github-action-publish-binaries@master
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.TOKEN_ACCESS }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
args: 'Adempiere-Vue.zip'
|
args: 'Adempiere-Vue.zip'
|
||||||
|
|
||||||
|
|
||||||
|
# Publish docker image to application
|
||||||
|
push-imame-gpr:
|
||||||
|
name: Push Docker image to GitHub Packages
|
||||||
|
needs:
|
||||||
|
- build-app
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Download build dist app
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: adempiere-vue
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
- name: Log in to GitHub Docker Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: docker.pkg.github.com
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: set lower case owner name
|
||||||
|
run: |
|
||||||
|
echo "OWNER_LC=${OWNER,,}" >> ${GITHUB_ENV}
|
||||||
|
echo "REPO_LC=${REPO,,}" >> ${GITHUB_ENV}
|
||||||
|
echo "IMAGE_NAME=adempiere-vue" >> ${GITHUB_ENV}
|
||||||
|
env:
|
||||||
|
OWNER: '${{ github.repository_owner }}'
|
||||||
|
REPO: '${{ github.repository }}'
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./build/Dockerfile.prod
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
docker.pkg.github.com/${{ env.REPO_LC }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
|
||||||
|
docker.pkg.github.com/${{ env.REPO_LC }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}
|
||||||
|
|
||||||
|
- name: Image digest
|
||||||
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
|
||||||
|
|
||||||
|
# Build dist documentation ADempiere-Vue
|
||||||
|
build-docs:
|
||||||
|
name: Build dist ADempiere-Vue docs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [12.x]
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Node configuration
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Generate dist docs
|
||||||
|
run: |
|
||||||
|
cd docs
|
||||||
|
npm i
|
||||||
|
npm run build --if-present
|
||||||
|
|
||||||
|
- name: Upload dist docs
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: adempiere-vue-docs
|
||||||
|
path: docs/.vuepress/dist
|
||||||
|
|
||||||
|
|
||||||
|
# Publish dist binaries to documentation
|
||||||
|
publish-docs-dist:
|
||||||
|
name: Upload ADempiere-Vue docs binaries
|
||||||
|
needs:
|
||||||
|
- build-docs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download build dist docs
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: adempiere-vue-docs
|
||||||
|
|
||||||
|
- name: Compress files for documentation dist
|
||||||
|
uses: TheDoctor0/zip-release@0.6.0
|
||||||
|
with:
|
||||||
|
filename: 'Adempiere-Vue-Documentation.zip'
|
||||||
|
path: './'
|
||||||
|
|
||||||
|
- name: Publish documentation binary in repository
|
||||||
|
uses: skx/github-action-publish-binaries@master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
args: 'Adempiere-Vue-Documentation.zip'
|
||||||
|
15
build/Dockerfile.prod
Normal file
15
build/Dockerfile.prod
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
FROM nginx:1.19.9-alpine
|
||||||
|
|
||||||
|
|
||||||
|
LABEL maintainer="EdwinBetanc0urt@outlook.com" \
|
||||||
|
description="ADempiere-Vue"
|
||||||
|
|
||||||
|
|
||||||
|
ENV API_URL="https://api.erpya.com"
|
||||||
|
|
||||||
|
|
||||||
|
COPY build/start.sh .
|
||||||
|
COPY dist/* /usr/share/nginx/html/
|
||||||
|
|
||||||
|
|
||||||
|
CMD 'sh' 'start.sh'
|
10
build/start.sh
Normal file
10
build/start.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# folder with dist app files
|
||||||
|
cd /usr/share/nginx/html/static/js
|
||||||
|
|
||||||
|
# Set API Proxy connection
|
||||||
|
find -name 'app.*.js' -exec sed -i "s|https://api.erpya.com|$API_URL|g" {} \;
|
||||||
|
|
||||||
|
# Start nginx web server
|
||||||
|
nginx && tail -f /dev/null
|
@ -23,10 +23,10 @@
|
|||||||
"author": "PanJiaChen",
|
"author": "PanJiaChen",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prettier": "1.14.2",
|
|
||||||
"vuepress": "0.14.9",
|
|
||||||
"husky": "0.14.3",
|
"husky": "0.14.3",
|
||||||
"lint-staged": "7.2.2"
|
"lint-staged": "7.2.2",
|
||||||
|
"prettier": "1.14.2",
|
||||||
|
"vuepress": "0.14.9"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": ">=0.21.1",
|
"axios": ">=0.21.1",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user