diff --git a/.github/workflows/jenkinsfile b/.github/workflows/jenkinsfile new file mode 100644 index 0000000..0d1f69c --- /dev/null +++ b/.github/workflows/jenkinsfile @@ -0,0 +1,17 @@ +pipeline { + agent any + + stages { + stage('Build') { + steps { + script { + def imageName = "my-docker-image" + def imageTag = "${env.BUILD_NUMBER}" + + // Build the Docker image + sh "docker build -t ${imageName}:${imageTag} ." + } + } + } + } +} \ No newline at end of file diff --git a/.github/workflows/jenkinstogithub.yaml b/.github/workflows/jenkinstogithub.yaml new file mode 100644 index 0000000..7fe71af --- /dev/null +++ b/.github/workflows/jenkinstogithub.yaml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: '11' + + - name: Build and test + run: | + ./gradlew clean build + + - name: Publish artifacts + uses: actions/upload-artifact@v2 + with: + name: jar + path: build/libs/*.jar \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5469602..0e5e1b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,10 @@ FROM node:latest as node WORKDIR /app COPY . . +RUN npm install -g @angular/cli RUN npm install -RUN npm run build --prod +RUN ng build --prod # stage 2 FROM nginx:alpine -COPY --from=node /app/dist/angular-app /usr/share/nginx/html \ No newline at end of file +COPY --from=node /app/dist/angular-app /usr/share/nginx/html