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 03:47:44 +00:00
|
|
|
entrypoint: 'sh -c'
|
2023-08-22 03:44:57 +00:00
|
|
|
args: |
|
|
|
|
npm install
|
|
|
|
npm run build -- --outputPath=dist
|
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 03:54:15 +00:00
|
|
|
entrypoint: '/bin/sh -c'
|
2023-08-22 03:49:19 +00:00
|
|
|
args: |
|
2023-08-22 03:40:28 +00:00
|
|
|
echo "FROM nginx:alpine" > Dockerfile
|
|
|
|
echo "COPY dist /usr/share/nginx/html" >> Dockerfile
|
|
|
|
echo "WORKDIR /usr/share/nginx/html/" >> Dockerfile
|
|
|
|
docker build -t ${{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 }}
|