-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (29 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
45 lines (29 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FROM maven:3.9.9-amazoncorretto-21-debian-bookworm AS builder
WORKDIR /app
### install yarn and nodejs
RUN apt-get update && \
apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get install -y nodejs && \
npm install -g yarn
### install frontend dependencies
COPY ./src/main/resources/frontend/package.json ./src/main/resources/frontend/yarn.lock ./src/main/resources/frontend/
RUN cd src/main/resources/frontend && \
yarn
### install backend dependencies
COPY ./pom.xml .
RUN mvn dependency:go-offline
### build frontend
COPY ./src/main/resources/frontend ./src/main/resources/frontend
RUN cd src/main/resources/frontend && \
yarn build
### build backend
COPY ./src ./src
RUN mvn clean package -DskipTests
FROM maven:3.9.9-amazoncorretto-21-debian-bookworm AS runner
RUN apt-get update && \
apt-get install -y git
COPY --from=builder /app/target/automatico-1.0-SNAPSHOT.jar /app/target/
ENV LOKI_URL="loki:3100"
EXPOSE 8080
CMD ["java", "-Dlog4j2.configurationFile=log4j.properties", "-Dlog4j2.debug=false", "-jar", "/app/target/automatico-1.0-SNAPSHOT.jar"]