diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml new file mode 100644 index 00000000..35219d1d --- /dev/null +++ b/.github/workflows/build-docker-image.yml @@ -0,0 +1,45 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + IMAGE_NAME: my-docker-image + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Docker Lint + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: ./docker/Dockerfile + failure-threshold : warning + + - name: Log in to Docker Hub + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4.3.0 + with: + images: ${{ secrets.DOCKER_USERNAME }}/tp_gr11_pl_seb + + - name: Build and push Docker image + uses: docker/build-push-action@v4.0.0 + with: + context: ./docker/ + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..c6007cf8 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,17 @@ +# Use an official Ubuntu image as the base image +FROM ubuntu:20.04 + +# Update the package list and upgrade the installed packages +RUN apt-get update && apt-get upgrade -y + +# Install the necessary packages +RUN apt-get install -y nano=4.8-1ubuntu1 + +# Set the working directory +WORKDIR /app + +# Copy the application code to the working directory +COPY . . + +# Specify the command to run when the container starts +CMD [ "/bin/bash" ] diff --git a/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile b/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile index 66991b29..b6dfe1da 100644 --- a/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile +++ b/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile @@ -4,7 +4,7 @@ ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ JHIPSTER_SLEEP=0 # add directly the war -ADD *.war /app.war +#ADD *.war /app.war VOLUME /tmp EXPOSE 8080