Commit 67404cfb by qp65053

ci/cd

parent 76f7aea0
stages:
- build
- make
- deploy
variables:
VERSION: "3.$CI_PIPELINE_ID"
BUILDDIR: "/builds"
LOCALDIR: "/opt/gitlab-runner/builds"
NAMESPACE: "srs-prd"
ppt-server-build:
stage: build
tags:
- test-ppt-server-shell
only:
- test
retry: 2
script:
#- GO111MODULE=auto
#- mkdir -p ${BUILDDIR}/ppt-server
#- rm -rf ${BUILDDIR}/ppt-server/*
#- go build -o ${BUILDDIR}/ppt-server/ppt-server
#- cp -f Dockerfile ${BUILDDIR}/ppt-server/
#- cp -rf conf ${BUILDDIR}/ppt-server/
#- cd ${BUILDDIR}/ppt-server/
- docker build -t registry.cn-beijing.aliyuncs.com/offcn_llive/ppt-server:$VERSION .
- docker push registry.cn-beijing.aliyuncs.com/offcn_llive/ppt-server:$VERSION
- docker rmi registry.cn-beijing.aliyuncs.com/offcn_llive/ppt-server:$VERSION &
ppt-server-deploy:
stage: deploy
tags:
- test-ppt-server-shell
only:
- test
retry: 2
before_script:
- CLUSTER="hb2-center"
script:
- set -x
- for cs in ${CLUSTER[@]};do \
- kubectl set image -n ${NAMESPACE} deployment/ppt-server-deployment ppt-server=registry.cn-beijing.aliyuncs.com/offcn_llive/ppt-server:$VERSION; \
- done
\ No newline at end of file
FROM registry.cn-beijing.aliyuncs.com/offcn_llive/go:build as build
COPY . /tmp/develop
RUN cd /tmp/develop \
&& go build -o /tmp/ppt-server main.go
#FROM debian:buster-slim
FROM registry.cn-beijing.aliyuncs.com/offcn_llive/go:runtime-alpine-3.10
ENV branch test
ENV rb_host rmq-cluster-balancer
ENV rb_user video
ENV rb_pass 1fqH4WFR19uckgRyHzgISw
ENV read_sql rr-2ze1xl88115o8i2umlo.mysql.rds.aliyuncs.com
ENV read_user video
ENV read_pass 'vlty&AxMwT$lmLv6bN8dkDuBYlh%N5pe'
ENV write_sql rm-2zevlk47ul0ovuci80o.mysql.rds.aliyuncs.com
ENV write_user video
ENV write_pass 'vlty&AxMwT$lmLv6bN8dkDuBYlh%N5pe'
COPY --chown=1000:1000 --from=build /tmp/ppt-server /src/ppt-server/
COPY --chown=1000:1000 conf/ /src/ppt-server/conf
RUN chmod +x /src/ppt-server/ppt-server
WORKDIR /src/ppt-server/
CMD ["./ppt-server"]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment