-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
47 lines (38 loc) · 1.27 KB
/
Dockerfile
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
46
47
FROM adoptopenjdk/openjdk11:alpine AS build
LABEL description="Wire Poll Bot"
LABEL project="wire-bots:polls"
ENV PROJECT_ROOT /src
WORKDIR $PROJECT_ROOT
# Copy gradle settings
COPY build.gradle.kts settings.gradle.kts gradle.properties gradlew $PROJECT_ROOT/
# Make sure gradlew is executable
RUN chmod +x gradlew
# Copy gradle specification
COPY gradle $PROJECT_ROOT/gradle
# Download gradle
RUN ./gradlew --version
# download and cache dependencies
RUN ./gradlew resolveDependencies --no-daemon
# Copy project and build
COPY . $PROJECT_ROOT
RUN ./gradlew distTar --no-daemon
# Runtime
FROM adoptopenjdk/openjdk11:alpine-jre
ENV APP_ROOT /app
WORKDIR $APP_ROOT
# Obtain built from the base
COPY --from=build /src/build/distributions/app.tar $APP_ROOT/
# Extract executables
RUN mkdir $APP_ROOT/run
RUN tar -xvf app.tar --strip-components=1 -C $APP_ROOT/run
# ------------------- Wire common -----------------
# create version file
ARG release_version=development
ENV RELEASE_FILE_PATH=$APP_ROOT/run/release.txt
RUN echo $release_version > $RELEASE_FILE_PATH
# enable json logging
# TODO enable this once we fully migrate to JSON logging everywhere
# ENV JSON_LOGGING=true
# /------------------ Wire common -----------------
EXPOSE 8080
ENTRYPOINT ["/bin/sh", "-c", "/app/run/bin/polls"]