Skip to content

Commit

Permalink
Merge pull request #97 from lbzss/feat-action
Browse files Browse the repository at this point in the history
Feat action
  • Loading branch information
lbzss authored Nov 1, 2023
2 parents f65e06a + d33c356 commit 686399f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Docker

on:
workflow_dispatch:
push:
branches:
- 'master'

env:
IMAGE_VERSION: latest

jobs:
pack:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: docker login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Get current timestamp
id: timestamp
run: echo "::set-output name=timestamp::$(date +%s)"

- name: Get short HEAD
id: head
run: echo "::set-output name=head::$(git rev-parse --short HEAD)"

- name: docker build
env:
IMAGE_TAG: ${{ steps.timestamp.outputs.timestamp }}-${{ steps.head.outputs.head }}
run: |
docker build -t chaoyue/kubecit-web:$IMAGE_TAG -f ./Dockerfile .
docker push chaoyue/kubecit-web:$IMAGE_TAG
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM node:latest as build-stage
WORKDIR /app
# ENV NODE_ENV production
# COPY package*.json ./
# RUN npm install
# RUN npm run build:pro
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build



FROM nginx:stable-alpine
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 686399f

Please sign in to comment.