-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from WeBankPartners/terraform_go_dev
Terraform go dev
- Loading branch information
Showing
1,431 changed files
with
326,821 additions
and
62,359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
# IDEA | ||
.idea | ||
.editorconfig | ||
.vscode | ||
|
||
|
||
# dependencies | ||
*/node_modules/ | ||
*/node/ | ||
*/build | ||
*/package-lock.json | ||
*/build | ||
.DS_Store | ||
terraform-server/logs | ||
*.swp | ||
*.swo | ||
*.pid | ||
*.log | ||
*.pyc | ||
static/.DS_Store | ||
/.idea/* | ||
test.py | ||
test/ | ||
*_beta/ | ||
terraform-ui/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,14 @@ | ||
FROM python:2.7.18-slim | ||
LABEL maintainer = "Webank CTB Team" | ||
FROM ccr.ccs.tencentyun.com/webankpartners/terrafrom-base:v1.0.3 | ||
|
||
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \ | ||
sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \ | ||
mkdir /data && mkdir -p /app/wecube_plugins_terraform | ||
ENV BASE_HOME=/app/terraform | ||
|
||
WORKDIR /app/wecube_plugins_terraform/ | ||
RUN mkdir -p $BASE_HOME $BASE_HOME/conf $BASE_HOME/logs | ||
|
||
COPY . . | ||
ADD build/start.sh $BASE_HOME/ | ||
ADD build/stop.sh $BASE_HOME/ | ||
ADD build/default.json $BASE_HOME/conf/ | ||
ADD terraform-server/terraform-server $BASE_HOME/ | ||
ADD ui/dist $BASE_HOME/public | ||
|
||
RUN mkdir -p /usr/local/share/terraform/plugins && \ | ||
tar -zxvf /app/wecube_plugins_terraform/plugins/registry.terraform.io.tar.gz -C /usr/local/share/terraform/plugins && \ | ||
rm -rf /app/wecube_plugins_terraform/plugins/registry.terraform.io.tar.gz && \ | ||
rm -rf /app/wecube_plugins_terraform/bin/terraform_0.15.5_linux_amd64.zip && \ | ||
ls /app/wecube_plugins_terraform/bin && \ | ||
\cp /app/wecube_plugins_terraform/bin/terraform /usr/bin/terraform && \ | ||
ls -la && \ | ||
apt update && apt-get -y install gcc python-dev && \ | ||
pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r /app/wecube_plugins_terraform/requirements.txt && \ | ||
chmod +x /app/wecube_plugins_terraform/bin/*.sh | ||
|
||
EXPOSE 8999 | ||
CMD ["/app/wecube_plugins_terraform/bin/start.sh"] | ||
WORKDIR $BASE_HOME | ||
ENTRYPOINT ["/bin/sh", "start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
current_dir=$(shell pwd) | ||
project_name=$(shell basename "${current_dir}") | ||
version=${PLUGIN_VERSION} | ||
version=$(PLUGIN_VERSION) | ||
project_dir=$(shell basename "${current_dir}") | ||
|
||
clean: | ||
rm -rf package | ||
rm -rf terraform-server/terraform-server | ||
rm -rf ui/dist | ||
rm -rf ui/plugin | ||
|
||
build: clean | ||
chmod +x ./build/*.sh | ||
docker run --rm -v $(current_dir):/go/src/github.com/WeBankPartners/$(project_dir) --name build_$(project_dir) ccr.ccs.tencentyun.com/webankpartners/golang-ext:v1.15.6 /bin/bash /go/src/github.com/WeBankPartners/$(project_dir)/build/build-server.sh | ||
./build/build-ui.sh $(current_dir) | ||
|
||
image: clean | ||
cd bin && unzip -o terraform_0.15.5_linux_amd64.zip | ||
docker build -t $(project_name):$(version) . | ||
image: build | ||
docker build -t $(project_dir):$(version) . | ||
|
||
package: image | ||
rm -rf package | ||
mkdir -p package | ||
cd terraform-ui && npm --registry https://registry.npm.taobao.org install --unsafe-perm | ||
cd terraform-ui && npm rebuild node-sass | ||
cd terraform-ui && npm run plugin | ||
cd terraform-ui/dist && zip -9 -r ui.zip . | ||
cd package && mv ../terraform-ui/dist/ui.zip . | ||
cp doc/init.sql package/init.sql | ||
cat doc/init_data.sql >> package/init.sql | ||
cat doc/update.sql >> package/init.sql | ||
cd package && sed -i 's/{{PLUGIN_VERSION}}/$(version)/' ../register.xml | ||
cd package && sed -i 's/{{IMAGENAME}}/$(project_name):$(version)/g' ../register.xml | ||
cd package && sed -i 's/{{CONTAINERNAME}}/$(project_name)-$(version)/g' ../register.xml | ||
cd package && docker save -o image.tar $(project_name):$(version) | ||
cp register.xml package/ | ||
cd package && zip -9 $(project_name)-$(version).zip image.tar register.xml init.sql ui.zip | ||
cd package && rm -f image.tar | ||
docker rmi $(project_name):$(version) | ||
mkdir -p plugin | ||
cp -r ui/dist/* plugin/ | ||
zip -r ui.zip plugin | ||
rm -rf plugin | ||
cp build/register.xml ./ | ||
cp wiki/init.sql ./init.sql | ||
sed -i "s~{{PLUGIN_VERSION}}~$(version)~g" ./register.xml | ||
sed -i "s~{{REPOSITORY}}~$(project_dir)~g" ./register.xml | ||
docker save -o image.tar $(project_dir):$(version) | ||
zip $(project_dir)-$(version).zip image.tar init.sql register.xml ui.zip | ||
rm -f register.xml init.sql ui.zip | ||
rm -rf ./*.tar | ||
docker rmi $(project_dir):$(version) | ||
|
||
upload: package | ||
$(eval container_id:=$(shell docker run -v $(current_dir)/package:/package -itd --entrypoint=/bin/sh minio/mc)) | ||
$(eval container_id:=$(shell docker run -v $(current_dir):/package -itd --entrypoint=/bin/sh minio/mc)) | ||
docker exec $(container_id) mc config host add wecubeS3 $(s3_server_url) $(s3_access_key) $(s3_secret_key) wecubeS3 | ||
docker exec $(container_id) mc cp /package/$(project_name)-$(version).zip wecubeS3/wecube-plugin-package-bucket | ||
docker stop $(container_id) | ||
docker exec $(container_id) mc cp /package/$(project_dir)-$(version).zip wecubeS3/wecube-plugin-package-bucket | ||
docker rm -f $(container_id) | ||
rm -rf $(project_name)-$(version).zip | ||
rm -rf $(project_dir)-$(version).zip |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.