<profiles>
<profile>
<id>production</id>
<properties>
<vaadin.productionMode>true</vaadin.productionMode>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
<goal>build-frontend</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
English Documentation
Docker Deployment
When providing and deploying the application in Docker containers, it should be noted that the application is deployed as a .jar file, but the product data is unpacked and copied into the container. For this, the vaadin.productionMode
must first be set to true
in the pom.xml
.
Dockerfile
example:
FROM eclipse-temurin:21-jre-jammy
RUN apt-get update \
&& ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata
ARG UID=999
ARG GID=999
ENV JAVA_TOOL_OPTIONS "-Xms480m -Xmx1024m"
RUN groupadd --gid $GID spring \
&& useradd -r -m -d /opt/spring -s /sbin/nologin --gid $GID --uid $UID -c "Spring user" spring \
&& chmod 755 /opt/spring \
&& mkdir -p /var/opt/spring \
&& chown spring: /var/opt/spring \
&& chmod 755 /var/opt/spring
WORKDIR /opt/spring
COPY ${PATH_TO_APPLICATION_JAR} application.jar
COPY ${PATH_TO_PRODUCT_FOLDER} /var/opt/spring/produkte
RUN chown -R spring: /var/opt/spring
USER $UID
EXPOSE 8080
CMD ["java", \
"-Dspring.profiles.active=production", \
"-jar", \
"application.jar", \
"--server.port=8080", \
"--server.forward-headers-strategy=FRAMEWORK"]
docker-compose.yml
example:
version: '2.4'
services:
productdesigner-sample:
container_name: ${CONTAINER_NAME}-sample
build:
context: ../
dockerfile: ./path/to/Dockerfile
args:
- PATH_TO_APPLICATION_JAR=${PATH_TO_APPLICATION_JAR}
- PATH_TO_PRODUCT_FOLDER=${PATH_TO_PRODUCT_FOLDER}
environment:
SPRING_PROFILES_ACTIVE: production
ips-product-designer.ips-project-path: /var/opt/spring/produkte
labels:
url: ${CONTAINER_NAME}-sample
entry-path: ui
networks:
default:
name: network-${CONTAINER_NAME}
labels:
retention: ${CONTAINER_RETENTION}