Skip to content

Dockerized and built pipelines #12

Dockerized and built pipelines

Dockerized and built pipelines #12

Workflow file for this run

name: CICD
on:
push:
branches: [deploy-to-ec2]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build Project
run: |
cd geodata
mvn clean install -DskipTests
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Build Docker Image
run: docker build -t snowgod/geodata-usgs -f geodata/Dockerfile geodata/
- name: Publish image to Docker Hub
run: docker push snowgod/geodata-usgs:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Pull image from Docker Hub
run: docker pull snowgod/geodata-usgs:latest
- name: Delete old container
run: docker rm -f earthquake-container
- name: Run Docker container
run: docker run -d -p 8082:8082 --name earthquake-container snowgod/geodata-usgs