forked from JointCloud/JCC-RIP
Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
devad | 63296475e5 | |
jagger | 073bbd233c | |
devad | 7b5f952d9f | |
jagger | fab58e620c | |
annzee | 93cbf732b1 |
|
@ -38,17 +38,26 @@ jobs:
|
|||
username: ${{ secrets.ALIYUN_USERNAME }}
|
||||
password: ${{ secrets.ALIYUN_PASSWORD }}
|
||||
|
||||
- name: Get commit ID and build time
|
||||
id: get_tags
|
||||
run: |
|
||||
echo "::set-output name=build_time::$(date +'%Y%m%d%H%M%S')"
|
||||
|
||||
- name: Build and push multi-arch image
|
||||
run: |
|
||||
docker buildx build --platform linux/amd64,linux/arm64 -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} --push .
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} \
|
||||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get_tags.outputs.build_time }} \
|
||||
--push .
|
||||
|
||||
- name: Set up SSH key
|
||||
- name: Set up Kubernetes CLI
|
||||
uses: azure/setup-kubectl@v1
|
||||
|
||||
- name: Configure kubeconfig
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
|
||||
mkdir -p ~/.kube
|
||||
echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config
|
||||
|
||||
- name: SSH to remote server and restart deployment
|
||||
if: github.event_name != 'pull_request'
|
||||
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "kubectl rollout restart deployment ${{ secrets.SSH_DEPLOYMENT }} -n ${{ secrets.SSH_NAMESPACE }}"
|
||||
- name: Restart Deployment
|
||||
run: kubectl rollout restart deployment ${{ secrets.SSH_DEPLOYMENT }}
|
|
@ -4,7 +4,7 @@ WORKDIR /app
|
|||
|
||||
COPY . .
|
||||
COPY deploy/nginx/ /app/
|
||||
RUN npm install && npm run build:prod
|
||||
RUN npm install && npm run build:stage
|
||||
|
||||
FROM --platform=$TARGETPLATFORM nginx:stable-alpine
|
||||
WORKDIR /app
|
||||
|
|
Loading…
Reference in New Issue