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: |
|
2023-12-13 22:30:26 +00:00
|
|
|
-c "npm install --registry=https://registry.npm.taobao.org && \
|
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: |
|
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 }}推送成功'
|