angular2docker/action.yml
2023-08-22 12:02:32 +08:00

23 lines
895 B
YAML

# 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:
entrypoint: "/bin/bash -c"
args: |
npm install
npm run build -- --outputPath=dist
- uses: docker://docker:git
with:
entrypoint: "/bin/bash -c"
args: |
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 }}