Skip to content

Commit

Permalink
Merge pull request #12 from ALEEF02/feature/docker
Browse files Browse the repository at this point in the history
Feature/docker
  • Loading branch information
JonMike8 authored Dec 3, 2024
2 parents 4c72ba4 + 0f0ecb4 commit f042d78
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build, Push and Deploy a Docker Image

on:
push:
branches: [main]
workflow_dispatch: # Allows for manual triggering

permissions:
contents: read
packages: write

jobs:
build-push-deploy-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
12 changes: 12 additions & 0 deletions MavenBack/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM maven:3.9.4-eclipse-temurin-21 AS build

WORKDIR /app
COPY pom.xml ./
COPY src ./src
RUN mvn clean verify -DskipTests

FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app/app.jar"]

0 comments on commit f042d78

Please sign in to comment.