vue2docker/action.yml

32 lines
1.3 KiB
YAML
Raw Normal View History

2023-08-22 03:40:28 +00:00
# action.yml
name: 'build docker image and push to code'
description: 'build docker image and push to simcu code'
runs:
using: 'composite'
steps:
- uses: docker://node:18
with:
2023-08-22 04:04:52 +00:00
entrypoint: "/bin/bash"
2023-08-22 03:44:57 +00:00
args: |
2023-08-22 06:51:31 +00:00
-c "npm install && \
npm run build -- --outputPath=dist"
- uses: docker://ubuntu:latest
with:
entrypoint: "/bin/bash"
args: |
-c 'echo "FROM nginx:alpine" > Dockerfile && \
echo "COPY dist /usr/share/nginx/html" >> Dockerfile && \
echo "WORKDIR /usr/share/nginx/html/" >> Dockerfile && \
echo "已经构建完DOCKERFILE了" && \
cat Dockerfile'
2023-08-22 03:40:28 +00:00
2023-08-22 03:53:18 +00:00
- uses: docker://docker:git
2023-08-22 03:47:44 +00:00
with:
2023-08-22 07:04:15 +00:00
entrypoint: "/bin/sh"
2023-08-22 03:49:19 +00:00
args: |
2023-08-22 06:51:31 +00:00
-c 'docker build -t ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }} . && \
echo ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }}已经构建完了 && \
docker login ${{env.DOCKER_REGISTRY}} -u ${{env.DOCKER_USER}} -p ${{env.DOCKER_PASS}} && \
docker push ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }} && \
echo ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }}推送成功'