-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathjava.Dockerfile
More file actions
61 lines (48 loc) · 2.07 KB
/
java.Dockerfile
File metadata and controls
61 lines (48 loc) · 2.07 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Build in a full featured container
ARG TARGETARCH
FROM --platform=linux/$TARGETARCH eclipse-temurin:21-jammy AS build
# Install protobuf compiler and dependencies
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install --no-install-recommends --assume-yes \
protobuf-compiler=3.12.4* git=1:2.34.1-1ubuntu1
# Get go compiler
ARG TARGETARCH
RUN wget -q https://go.dev/dl/go1.21.12.linux-${TARGETARCH}.tar.gz \
&& tar -C /usr/local -xzf go1.21.12.linux-${TARGETARCH}.tar.gz
WORKDIR /app
# Copy CLI build dependencies
COPY cmd ./cmd
COPY loadgen ./loadgen
COPY metrics ./metrics
COPY scenarios ./scenarios
COPY workers/*.go ./workers/
COPY workers/go/harness/api ./workers/go/harness/api
COPY go.mod go.sum ./
# Build the CLI
RUN CGO_ENABLED=0 /usr/local/go/bin/go build -o temporal-omes ./cmd
ARG SDK_VERSION
# Optional SDK dir to copy, defaults to unimportant file
ARG SDK_DIR=.gitignore
COPY ${SDK_DIR} ./repo
# Copy the worker files
COPY workers/proto ./workers/proto
COPY workers/java ./workers/java
# Download Gradle using wrapper to cache it in build layer
ENV GRADLE_USER_HOME="/gradle"
RUN /app/workers/java/gradlew --version
# Build the worker
WORKDIR /app
RUN CGO_ENABLED=0 ./temporal-omes prepare-worker --language java --dir-name prepared --version "$SDK_VERSION"
# Copy the CLI and prepared feature to a "run" container. Distroless isn't used here since we run
# through Gradle and it's more annoying than it's worth to get its deps to line up
FROM --platform=linux/$TARGETARCH eclipse-temurin:21
RUN apt-get update && apt-get install --no-install-recommends --assume-yes git && rm -rf /var/lib/apt/lists/*
ENV GRADLE_USER_HOME="/gradle"
COPY --from=build /app/temporal-omes /app/temporal-omes
COPY --from=build /app/workers/proto/harness /app/workers/proto/harness
COPY --from=build /app/workers/java /app/workers/java
COPY --from=build /app/repo /app/repo
COPY --from=build /gradle /gradle
# Use entrypoint instead of command to "bake" the default command options
ENTRYPOINT ["/app/temporal-omes", "run-worker", "--language", "java", "--dir-name", "prepared"]