Skip to content

Commit f490746

Browse files
committed
new docker folder
1 parent 31753ea commit f490746

6 files changed

Lines changed: 34 additions & 2 deletions

File tree

api/docker.old/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
DB_URL=host.docker.internal:5432/common_app
2+
DB_USERNAME=root
3+
DB_PASSWORD=root
4+
TOKEN_SECRET=secret

api/docker.old/Dockerfile.prod

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM maven:3.8.5-openjdk-17 as BUILDER
2+
3+
WORKDIR /usr/src/app
4+
5+
COPY ./pom.xml ./pom.xml
6+
COPY ./src ./src
7+
8+
RUN --mount=type=cache,target=/root/.m2 mvn package -DskipTests
9+
10+
FROM openjdk:17-alpine
11+
12+
ENV SERVER_PORT=80
13+
14+
WORKDIR /usr/src/app
15+
16+
COPY --from=BUILDER /usr/src/app/target/api*.jar ./api.jar
17+
18+
EXPOSE ${SERVER_PORT}
19+
20+
ENTRYPOINT [ "java", "-jar", "api.jar" ]

api/docker/Dockerfile.prod

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@ RUN --mount=type=cache,target=/root/.m2 mvn package -DskipTests
99

1010
FROM openjdk:17-alpine
1111

12+
WORKDIR /usr/src/app
13+
1214
ENV SERVER_PORT=80
15+
ENV DB_SHOW_SQL=false
16+
ENV DOCKERIZE_VERSION v0.6.1
1317

14-
WORKDIR /usr/src/app
18+
COPY --from=BUILDER /usr/src/app/target/*.jar ./api.jar
19+
20+
RUN apk add --no-cache openssl
1521

16-
COPY --from=BUILDER /usr/src/app/target/api*.jar ./api.jar
22+
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
23+
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
24+
&& rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
1725

1826
EXPOSE ${SERVER_PORT}
1927

0 commit comments

Comments
 (0)