mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-07 18:25:45 +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:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
name: Build and deploy ADempiere-Vue docs
|
||||
# The type of runner that the job will run on
|
||||
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:
|
||||
- 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:
|
||||
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:
|
||||
release:
|
||||
types: [created]
|
||||
types:
|
||||
- created
|
||||
- edited
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
# Build dist application ADempiere-Vue
|
||||
build-app:
|
||||
name: Build dist ADempiere-Vue
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [10.x, 12.x, 13.x, 14.x]
|
||||
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Node configuration
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: npm i
|
||||
- run: npm test
|
||||
- run: npm run build:prod --if-present
|
||||
- run: set -e
|
||||
- run: |
|
||||
cd docs
|
||||
npm i
|
||||
npm run build
|
||||
cache: 'npm'
|
||||
|
||||
publish-dist:
|
||||
needs: build
|
||||
- name: Set tag version into config file
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
- name: Download build dist app
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
node-version: 12
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm i
|
||||
- run: sed -i "s|releaseNoForDocumentation|${{ github.event.release.tag_name }}|g" config/default.json
|
||||
- run: npm run build:prod --if-present
|
||||
- uses: TheDoctor0/zip-release@0.4.1
|
||||
name: adempiere-vue
|
||||
|
||||
- name: Compress files for application dist
|
||||
uses: TheDoctor0/zip-release@0.6.0
|
||||
with:
|
||||
filename: 'Adempiere-Vue.zip'
|
||||
path: 'dist/'
|
||||
- uses: skx/github-action-publish-binaries@master
|
||||
path: './'
|
||||
|
||||
- name: Publish application binary in repository
|
||||
uses: skx/github-action-publish-binaries@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.TOKEN_ACCESS }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
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",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"prettier": "1.14.2",
|
||||
"vuepress": "0.14.9",
|
||||
"husky": "0.14.3",
|
||||
"lint-staged": "7.2.2"
|
||||
"lint-staged": "7.2.2",
|
||||
"prettier": "1.14.2",
|
||||
"vuepress": "0.14.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": ">=0.21.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user