Skip to content

Commit 068c86c

Browse files
authored
Add Dockerfile (#120)
1 parent 0d3a620 commit 068c86c

3 files changed

Lines changed: 49 additions & 0 deletions

File tree

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git
2+
.github
3+
.gradle
4+
bin
5+
target
6+
build

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM amazoncorretto:17-al2-jdk
2+
3+
# Create a user
4+
RUN yum update -y && \
5+
yum install -y shadow-utils && \
6+
yum clean all && \
7+
rm -rf /var/cache/dnf
8+
RUN groupadd -r appuser && \
9+
useradd -m -r -g appuser appuser
10+
USER appuser
11+
12+
WORKDIR /app/
13+
RUN chown -R appuser:appuser /app
14+
15+
# Install Gradle
16+
COPY --chown=appuser:appuser ./gradle/ /app/gradle/
17+
COPY --chown=appuser:appuser ./gradlew /app/
18+
RUN ./gradlew --version --no-daemon
19+
20+
# Install dependencies
21+
COPY --chown=appuser:appuser ./build.gradle ./settings.gradle /app/
22+
RUN ./gradlew dependencies --no-daemon
23+
24+
# Build project
25+
COPY --chown=appuser:appuser . /app/
26+
RUN ./gradlew build shadowJar --no-daemon
27+
28+
# Disable building a JAR because we already built it.
29+
ENV SHADOW=No

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,20 @@ If you wish to run _all_ benchmarks used to generate the reports above,
157157
you can run `./run-everything`. This will take several hours to complete, so
158158
be patient.
159159

160+
## Run on Docker
161+
162+
You can use Docker if you wish to reproduce the consistent environment
163+
or to run benchmarks in a separate safe environment.
164+
165+
Prerequisites:
166+
167+
* Docker
168+
169+
Build and run:
170+
171+
docker build -t java-json-benchmark:latest .
172+
docker run --rm -it java-json-benchmark:latest ./run deser
173+
160174
## Run on AWS
161175

162176
Prerequisites:

0 commit comments

Comments
 (0)