fix(cicd): refactor scripts for cicd
This commit is contained in:
parent
c897adc6ea
commit
2dc156cd95
11 changed files with 26 additions and 66 deletions
1
.github/workflows/cd_docker.yml
vendored
1
.github/workflows/cd_docker.yml
vendored
|
@ -1,4 +1,5 @@
|
||||||
name: cd-docker
|
name: cd-docker
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
FROM golang:1.15 as build-be
|
FROM golang:1.15 as build-be
|
||||||
ADD . /quickshare
|
ADD . /quickshare
|
||||||
WORKDIR /quickshare
|
WORKDIR /quickshare
|
||||||
RUN /quickshare/scripts/build_be_docker.sh
|
RUN /quickshare/scripts/build_exec.sh
|
||||||
|
|
||||||
FROM node as build-fe
|
FROM node as build-fe
|
||||||
COPY --from=build-be /quickshare /quickshare
|
COPY --from=build-be /quickshare /quickshare
|
||||||
WORKDIR /quickshare
|
WORKDIR /quickshare
|
||||||
RUN yarn install \
|
RUN yarn run build:fe \
|
||||||
&& yarn --cwd "src/client/web" run build \
|
|
||||||
&& cp -R /quickshare/public /quickshare/dist/quickshare
|
&& cp -R /quickshare/public /quickshare/dist/quickshare
|
||||||
|
|
||||||
FROM debian:stable-slim
|
FROM debian:stable-slim
|
||||||
|
|
|
@ -4,8 +4,13 @@
|
||||||
"src/client/web"
|
"src/client/web"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "scripts/build.sh",
|
"build:fe": "bash scripts/copy_js.sh && webpack --config src/client/web/webpack.app.prod.js",
|
||||||
"start": "cd src/client/web/ && yarn && yarn build && cd ../../.. && go run cmd/start/main.go -c `pwd`/configs/dev.yml"
|
"build:fe:dev": "bash scripts/copy_js_dev.sh && webpack --config src/client/web/webpack.app.dev.js --watch",
|
||||||
|
"build:fe:watch": "bash scripts/copy_js.sh && webpack --config src/client/web/webpack.app.prod.js --watch",
|
||||||
|
"start": "yarn build:fe && go run cmd/start/main.go -c `pwd`/configs/dev.yml",
|
||||||
|
|
||||||
|
"build": "yarn build:fe && bash scripts/build_be.sh",
|
||||||
|
"build:docker": "docker build . -t hexxa/quickshare:latest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"webpack-bundle-analyzer": "^4.4.2"
|
"webpack-bundle-analyzer": "^4.4.2"
|
||||||
|
|
BIN
public/static/img/favicon.png
Normal file
BIN
public/static/img/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
1
public/static/img/favicon.svg
Normal file
1
public/static/img/favicon.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="48" height="48" ><path fill="none" d="M0 0h24v24H0z"></path><path d="M9 3v2H4v14h16v-9h2v10a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h6zm7 2V1l7 6h-9a2 2 0 0 0-2 2v6h-2V9a4 4 0 0 1 4-4h2z"></path></svg>
|
After Width: | Height: | Size: 317 B |
11
public/static/manifest.json
Normal file
11
public/static/manifest.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"name": "Quickshare",
|
||||||
|
"short_name": "Quickshare",
|
||||||
|
"icons": [{
|
||||||
|
"src": "img/favicon.png",
|
||||||
|
"sizes": "512x512"
|
||||||
|
}],
|
||||||
|
"background_color": "#16a085",
|
||||||
|
"theme_color": "#ffffff",
|
||||||
|
"display": "fullscreen"
|
||||||
|
}
|
|
@ -1,30 +0,0 @@
|
||||||
export QSROOT=`pwd`
|
|
||||||
rm -r dist && mkdir dist
|
|
||||||
|
|
||||||
go get github.com/mitchellh/gox
|
|
||||||
cd cmd/start
|
|
||||||
gox \
|
|
||||||
-osarch="windows/386 windows/amd64 darwin/amd64 linux/386 linux/amd64 linux/arm linux/arm64" \
|
|
||||||
-output "$QSROOT/dist/quickshare_{{.OS}}_{{.Arch}}/quickshare"
|
|
||||||
|
|
||||||
cd $QSROOT/src/client/web
|
|
||||||
yarn build
|
|
||||||
|
|
||||||
cd $QSROOT
|
|
||||||
cp -R $QSROOT/public $QSROOT/dist/quickshare_windows_386
|
|
||||||
cp -R $QSROOT/public $QSROOT/dist/quickshare_windows_amd64
|
|
||||||
cp -R $QSROOT/public $QSROOT/dist/quickshare_darwin_amd64
|
|
||||||
cp -R $QSROOT/public $QSROOT/dist/quickshare_linux_386
|
|
||||||
cp -R $QSROOT/public $QSROOT/dist/quickshare_linux_amd64
|
|
||||||
cp -R $QSROOT/public $QSROOT/dist/quickshare_linux_arm
|
|
||||||
cp -R $QSROOT/public $QSROOT/dist/quickshare_linux_arm64
|
|
||||||
|
|
||||||
cd $QSROOT/dist
|
|
||||||
|
|
||||||
zip -r -q $QSROOT/dist/quickshare_windows_386.zip quickshare_windows_386/*
|
|
||||||
zip -r -q $QSROOT/dist/quickshare_windows_amd64.zip quickshare_windows_amd64/*
|
|
||||||
zip -r -q $QSROOT/dist/quickshare_darwin_amd64.zip quickshare_darwin_amd64/*
|
|
||||||
zip -r -q $QSROOT/dist/quickshare_linux_386.zip quickshare_linux_386/*
|
|
||||||
zip -r -q $QSROOT/dist/quickshare_linux_amd64.zip quickshare_linux_amd64/*
|
|
||||||
zip -r -q $QSROOT/dist/quickshare_linux_arm.zip quickshare_linux_arm/*
|
|
||||||
zip -r -q $QSROOT/dist/quickshare_linux_arm64.zip quickshare_linux_arm64/*
|
|
|
@ -1,11 +0,0 @@
|
||||||
export QSROOT=`pwd`
|
|
||||||
rm -r dist && mkdir dist
|
|
||||||
|
|
||||||
# set this for builders behind GFW...
|
|
||||||
go env -w GOPROXY=https://goproxy.cn,direct
|
|
||||||
go get -d -v ./...
|
|
||||||
go get github.com/mitchellh/gox
|
|
||||||
cd cmd/start
|
|
||||||
gox \
|
|
||||||
-osarch="linux/amd64" \
|
|
||||||
-output "$QSROOT/dist/quickshare/start"
|
|
|
@ -1,7 +0,0 @@
|
||||||
docker run \
|
|
||||||
--name quickshare \
|
|
||||||
-d -p :8686:8686 \
|
|
||||||
-v `pwd`/quickshare/root:/quickshare/root \
|
|
||||||
-e DEFAULTADMIN=qs \
|
|
||||||
-e DEFAULTADMINPWD=1234 \
|
|
||||||
hexxa/quickshare
|
|
|
@ -4,20 +4,11 @@
|
||||||
"description": "web client for quickshare",
|
"description": "web client for quickshare",
|
||||||
"main": "",
|
"main": "",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "yarn prod:addjs && yarn build:prod:wp",
|
"build": "webpack --config webpack.app.prod.js",
|
||||||
"build:prod:wp": "webpack --config webpack.app.prod.js",
|
|
||||||
"build:watch": "webpack --config webpack.app.prod.js --watch",
|
"build:watch": "webpack --config webpack.app.prod.js --watch",
|
||||||
"build:dev": "yarn dev:addjs && webpack --config webpack.app.dev.js --watch",
|
"build:dev": "webpack --config webpack.app.dev.js --watch",
|
||||||
"test": "jest test --maxWorkers=2",
|
"test": "jest test --maxWorkers=2",
|
||||||
"test:watch": "jest test --watch --maxWorkers=2",
|
"test:watch": "jest test --watch --maxWorkers=2"
|
||||||
"dev:addjs": "yarn && yarn dev:copy-immutable && yarn dev:copy-react-dom && yarn dev:copy-react",
|
|
||||||
"dev:copy-immutable": "cp ../../../node_modules/immutable/dist/immutable.min.js ../../../public/static/js/",
|
|
||||||
"dev:copy-react-dom": "cp ../../../node_modules/react-dom/umd/react-dom.development.js ../../../public/static/js/",
|
|
||||||
"dev:copy-react": "cp ../../../node_modules/react/umd/react.development.js ../../../public/static/js/",
|
|
||||||
"prod:addjs": "yarn && yarn prod:copy-immutable && yarn prod:copy-react-dom && yarn prod:copy-react",
|
|
||||||
"prod:copy-immutable": "cp ../../../node_modules/immutable/dist/immutable.min.js ../../../public/static/js/",
|
|
||||||
"prod:copy-react-dom": "cp ../../../node_modules/react-dom/umd/react-dom.production.min.js ../../../public/static/js/",
|
|
||||||
"prod:copy-react": "cp ../../../node_modules/react/umd/react.production.min.js ../../../public/static/js/"
|
|
||||||
},
|
},
|
||||||
"author": "hexxa",
|
"author": "hexxa",
|
||||||
"license": "LGPL-3.0",
|
"license": "LGPL-3.0",
|
||||||
|
|
|
@ -59,7 +59,7 @@ func NewServer(cfg gocfg.ICfg) (*Server, error) {
|
||||||
|
|
||||||
port := cfg.GrabInt("Server.Port")
|
port := cfg.GrabInt("Server.Port")
|
||||||
portStr, ok := cfg.String("ENV.PORT")
|
portStr, ok := cfg.String("ENV.PORT")
|
||||||
if ok {
|
if ok && portStr != "" {
|
||||||
port, err = strconv.Atoi(portStr)
|
port, err = strconv.Atoi(portStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("invalid port: %s", portStr))
|
panic(fmt.Sprintf("invalid port: %s", portStr))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue