Skip to content

Commit 7b8ba42

Browse files
authored
Fix/dockerfile errors (#185)
* fixing docker file * increasing memory * trying to fix jvm ci crash * reducing fork made it worse * java.library.path doesn't work on windows * maybe try this with file separator * trying file separator again * trying this again * trying absolute path * will this fix it * reverting files and removing java versions from dockerfile * adding java 21 as the container default * forgot to clean one comment
1 parent 8e37517 commit 7b8ba42

File tree

5 files changed

+14
-42
lines changed

5 files changed

+14
-42
lines changed

.github/workflows/unit-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ jobs:
4444
# give each OS its own artifact bundle
4545
name: build-artifacts-${{ matrix.os }}
4646
path: |
47-
jlama-cli/target/jlama-cli.jar
47+
jlama-cli/target/jlama-cli.jar

Dockerfile

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,11 @@
1-
FROM ubuntu:22.04 AS builder
2-
RUN apt-get update
3-
RUN apt-get install -y build-essential git zip curl zlib1g-dev
4-
5-
ENV SDKMAN_DIR=/root/.sdkman
6-
ENV JAVA_VERSION_20=20.0.2-graalce
7-
ENV JAVA_VERSION_21=21.0.2-graalce
8-
ENV JAVA_VERSION_22=22.0.2-graalce
9-
10-
RUN ["mkdir", "-p", "/build"]
11-
12-
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
13-
RUN curl -s "https://get.sdkman.io" | bash
14-
RUN chmod a+x "$SDKMAN_DIR/bin/sdkman-init.sh"
15-
16-
RUN set -x \
17-
&& echo "sdkman_auto_answer=true" > $SDKMAN_DIR/etc/config \
18-
&& echo "sdkman_auto_selfupdate=false" >> $SDKMAN_DIR/etc/config \
19-
&& echo "sdkman_insecure_ssl=false" >> $SDKMAN_DIR/etc/config
1+
FROM eclipse-temurin:21-jdk-jammy AS builder
202

21-
WORKDIR $SDKMAN_DIR
22-
RUN [[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh" && exec "$@"
23-
24-
RUN source /root/.bashrc
25-
RUN source "$SDKMAN_DIR/bin/sdkman-init.sh" && sdk install java $JAVA_VERSION_20
26-
RUN source "$SDKMAN_DIR/bin/sdkman-init.sh" && sdk install java $JAVA_VERSION_21
27-
RUN source "$SDKMAN_DIR/bin/sdkman-init.sh" && sdk install java $JAVA_VERSION_22
3+
RUN cat /etc/os-release
4+
RUN apt-get update
5+
RUN apt-get install -y build-essential git zip curl zlib1g-dev jq
286

297
WORKDIR /build
30-
RUN git clone https://github.com/tjake/sdkman-for-toolchains.git
31-
WORKDIR /build/sdkman-for-toolchains
32-
RUN source "$SDKMAN_DIR/bin/sdkman-init.sh" && ./mvnw -Pnative clean package
33-
RUN ["mkdir", "-p", "/root/.m2"]
34-
RUN printf "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<toolchains>\n</toolchains>" > /root/.m2/toolchains.xml
35-
RUN source "$SDKMAN_DIR/bin/sdkman-init.sh" && target/toolchains generate
36-
RUN cat /root/.m2/toolchains.xml
37-
WORKDIR /build
8+
389
COPY jlama-cli jlama-cli
3910
COPY jlama-core jlama-core
4011
COPY jlama-native jlama-native
@@ -43,12 +14,13 @@ COPY jlama-tests jlama-tests
4314
COPY .mvn .mvn
4415
COPY pom.xml .
4516
COPY mvnw .
17+
COPY .git .git
4618

47-
RUN --mount=type=cache,target=/root/.m2/repository source "$SDKMAN_DIR/bin/sdkman-init.sh" && sdk use java $JAVA_VERSION_22 && ./mvnw clean package -DskipTests
19+
RUN ./mvnw clean package -DskipTests
4820

49-
FROM openjdk:21-slim
50-
RUN apt-get update
51-
RUN apt-get install -y procps curl gzip
21+
FROM eclipse-temurin:21-jre-alpine
22+
RUN apk update
23+
RUN apk add procps curl gzip
5224

5325
LABEL org.opencontainers.image.source=https://github.com/tjake/Jlama
5426
RUN mkdir -p /profiler && curl -s -L https://github.com/async-profiler/async-profiler/releases/download/v3.0/async-profiler-3.0-linux-x64.tar.gz | tar zxvf - -C /profiler

jlama-tests/src/test/java/com/github/tjake/jlama/microbench/BatchBench.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,4 @@ public static void main(String[] args) throws Exception {
184184
}
185185
}
186186
}
187-
}
187+
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,4 +469,4 @@
469469
</build>
470470
</profile>
471471
</profiles>
472-
</project>
472+
</project>

run-cli.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# Function to get Java executable path
44
get_java_exec() {

0 commit comments

Comments
 (0)