Skip to content

Commit

Permalink
Multi-stage build in Dockerfile to remove gradle build files and decr…
Browse files Browse the repository at this point in the history
…ease image size
  • Loading branch information
0xf4b1 committed Aug 27, 2023
1 parent 3131e3d commit b0c1686
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
FROM ubuntu:jammy

RUN apt update && apt upgrade -y
RUN apt install -y openjdk-18-jre-headless nginx patch
RUN apt install -y openjdk-18-jre-headless

COPY . /app
WORKDIR /app

RUN patch -d / -p0 < nginx-default.patch
RUN ./gradlew distTar --no-daemon

FROM ubuntu:jammy

RUN apt update && apt upgrade -y
RUN apt install -y openjdk-18-jre-headless nginx patch

WORKDIR /app

COPY --from=0 /app/nginx-default.patch /app
RUN patch -d / -p0 < nginx-default.patch && rm nginx-default.patch

COPY --from=0 /app/build/distributions/traktor-streaming-proxy.tar /app
RUN tar xf traktor-streaming-proxy.tar --strip-components=1 && rm traktor-streaming-proxy.tar

RUN ./gradlew build --no-daemon
CMD nginx && ./gradlew run --no-daemon
CMD nginx && bin/traktor-streaming-proxy

0 comments on commit b0c1686

Please sign in to comment.