Skip to content

Commit

Permalink
Merge pull request #21 from teixeira-fernando/DockerFileConfig
Browse files Browse the repository at this point in the history
Created Docker files for both modules and a docker-compose.yml
  • Loading branch information
teixeira-fernando authored Nov 7, 2020
2 parents 77e26aa + 7c1a8f0 commit f606990
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 2 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches: [ master ]

jobs:
build:
quality-metrics:

runs-on: ubuntu-latest

Expand Down Expand Up @@ -52,5 +52,35 @@ jobs:
name: mutationCoverage-shop
path: shop/target/pit-reports

docker-publish:

runs-on: ubuntu-latest

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push - inventory
uses: docker/build-push-action@v2
with:
context: ./inventory
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/386
push: true
tags: ecommerceapp/inventory:latest
- name: Build and push - shop
uses: docker/build-push-action@v2
with:
context: ./shop
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/386
push: true
tags: ecommerceapp/shop:latest


2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
name: test-results-report
path: target/site/surefire-report.html


31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "3"

services:
mongodb:
image: mongo:latest
container_name: 'ecommerceapp-mongodb'
ports:
- "27017:27017"

inventory:
image: 'teixeirafernando/ecommerceapp-inventory:latest'
ports:
- "7080:7080"
depends_on:
- mongodb
links:
- mongodb
environment:
- spring.data.mongodb.host=mongodb

shop:
image: 'teixeirafernando/ecommerceapp-shop:latest'
ports:
- "7081:7081"
depends_on:
- mongodb
- inventory
links:
- mongodb
environment:
- spring.data.mongodb.host=mongodb
8 changes: 8 additions & 0 deletions inventory/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM openjdk:8-jdk-alpine
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring
ARG DEPENDENCY=target/dependency
COPY ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY ${DEPENDENCY}/META-INF /app/META-INF
COPY ${DEPENDENCY}/BOOT-INF/classes /app
ENTRYPOINT ["java","-cp","app:app/lib/*","com.ecommerceapp.inventory.InventoryApplication"]
8 changes: 8 additions & 0 deletions shop/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM openjdk:8-jdk-alpine
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring
ARG DEPENDENCY=target/dependency
COPY ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY ${DEPENDENCY}/META-INF /app/META-INF
COPY ${DEPENDENCY}/BOOT-INF/classes /app
ENTRYPOINT ["java","-cp","app:app/lib/*","com.ecommerceapp.shop.ShopApplication"]

0 comments on commit f606990

Please sign in to comment.