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:
|
2024-04-11 12:29:20 +00:00
|
|
|
- uses: docker://node:20
|
2023-08-22 03:40:28 +00:00
|
|
|
with:
|
2023-08-22 04:04:52 +00:00
|
|
|
entrypoint: "/bin/bash"
|
2023-08-22 03:44:57 +00:00
|
|
|
args: |
|
2024-04-11 12:32:22 +00:00
|
|
|
-c "npm install && \
|
2023-08-26 20:32:29 +00:00
|
|
|
npm run build -- --output-path=dist"
|
2023-08-22 06:51:31 +00:00
|
|
|
|
|
|
|
- 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: |
|
2024-06-15 17:58:07 +00:00
|
|
|
-c 'docker build -t ${{vars.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }} . && \
|
|
|
|
echo ${{vars.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }}已经构建完了 && \
|
|
|
|
docker login ${{vars.DOCKER_REGISTRY}} -u ${{vars.DOCKER_USER}} -p ${{vars.DOCKER_PASS}} && \
|
|
|
|
docker push ${{vars.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }} && \
|
|
|
|
echo ${{vars.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }}推送成功'
|