From c10055251d358f66abc591ec0b021c7a36c6b685 Mon Sep 17 00:00:00 2001 From: Martin Vysny Date: Wed, 4 Dec 2024 12:43:34 +0200 Subject: [PATCH] github actions: upgrade the plugins --- .github/workflows/maven.yml | 2 +- Dockerfile | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 3f3b94f..908b5c3 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -20,7 +20,7 @@ jobs: java-version: ${{ matrix.java }} distribution: 'temurin' - name: Cache Maven packages - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | ~/.m2/repository diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..276c002 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Allows you to run this app easily as a docker container. +# See README.md for more details. +# +# 1. Build the image with: docker build --no-cache -t test/vaadin8-sampler:latest . +# 2. Run the image with: docker run --rm -ti -p8080:8080 -m256m test/vaadin8-sampler +# +# Uses Docker Multi-stage builds: https://docs.docker.com/build/building/multi-stage/ + +# The "Build" stage. Copies the entire project into the container, into the /app/ folder, and builds it. +FROM eclipse-temurin:11 AS BUILD +RUN apt update && apt install unzip -y +COPY . /app/ +WORKDIR /app/ +RUN ./mvnw -C clean test package -Pproduction +WORKDIR /app/target/ +RUN ls -la +RUN unzip *.zip -d app/ +# At this point, we have the app (executable bash scrip plus a bunch of jars) in the +# /app/target/app/ folder. + +# The "Run" stage. Start with a clean image, and copy over just the app itself, omitting gradle, npm and any intermediate build files. +FROM eclipse-temurin:11 +COPY --from=BUILD /app/target/app /app/ +WORKDIR /app/ +EXPOSE 8080 +ENTRYPOINT ./bin/app