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 04:04:52 +00:00
|
|
|
-c "npm install"
|
|
|
|
-c " 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 04:04:52 +00:00
|
|
|
entrypoint: "/bin/bash"
|
2023-08-22 03:49:19 +00:00
|
|
|
args: |
|
2023-08-22 04:04:52 +00:00
|
|
|
-c 'echo "FROM nginx:alpine" > Dockerfile'
|
|
|
|
-c 'echo "COPY dist /usr/share/nginx/html" >> Dockerfile'
|
|
|
|
-c 'echo "WORKDIR /usr/share/nginx/html/" >> Dockerfile'
|
|
|
|
-c 'docker build -t ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }} .'
|
|
|
|
-c 'docker login ${{env.DOCKER_REGISTRY}} -u ${{env.DOCKER_USER}} -p ${{env.DOCKER_PASS}}'
|
|
|
|
-c 'docker push ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }}'
|