File tree Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Original file line number Diff line number Diff line change 1+ FROM maven:3.9.6-eclipse-temurin-21-alpine AS maven
2+
13FROM python:3.12-alpine3.20 AS builder
24
35ENV POETRY_NO_INTERACTION=1 \
@@ -23,13 +25,24 @@ ENV VIRTUAL_ENV=/app/.venv \
2325 PATH="/app/.venv/bin:$PATH"
2426
2527# Installing prerequisites
26- RUN apk add --update --no-cache bash curl shellcheck gawk git make \
27- && rm -rf /var/cache/apk/*
28+ RUN apk add --update --no-cache bash curl shellcheck gawk git make docker docker-cli-compose openrc \
29+ && rm -rf /var/cache/apk/* \
30+ RUN rc-update add docker boot
2831
2932# Install shdoc
3033RUN git clone --recursive https://github.com/reconquest/shdoc /tmp/shdoc
3134RUN make install -C /tmp/shdoc
3235
36+ # Install java and maven
37+ COPY --from=maven /opt/java/openjdk /opt/java/openjdk
38+ COPY --from=maven /usr/share/maven /usr/share/maven
39+ RUN ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
40+
41+ COPY --from=maven /usr/bin/mvn /usr/bin/mvn
42+ ENV PATH="/opt/java/openjdk/bin:$PATH"
43+ ENV MAVEN_HOME="/usr/share/maven"
44+ ENV JAVA_HOME="/opt/java/openjdk"
45+
3346# Create user
3447RUN addgroup -g 1000 app \
3548 && adduser --home /app -G app -u 1000 app -D
Original file line number Diff line number Diff line change @@ -135,8 +135,8 @@ function display_logs() {
135135function build() {
136136 info " Building source code in the target folder"
137137 if ! [[ -f $ECOCODE_JAVA_PLUGIN_JAR ]] || [[ $FORCE -gt 0 ]]; then
138- debug " mvn clean package -DskipTests"
139- if ! mvn clean package -DskipTests; then
138+ debug " mvn clean package -Dmaven.clean.failOnError=false - DskipTests"
139+ if ! mvn clean package -Dmaven.clean.failOnError=false - DskipTests; then
140140 return 1
141141 fi
142142 fi
Original file line number Diff line number Diff line change @@ -19,12 +19,19 @@ function docker_build() {
1919
2020function docker_run() {
2121 docker run --rm -it \
22- -e ENV=docker \
23- -p 8000:8000 \
22+ --name ecocode_java_utils \
23+ -u $( id -u) :$( getent group docker | cut -d: -f3) \
24+ -p :8000 \
25+ -v " //var/run/docker.sock:/var/run/docker.sock" \
26+ -v " $HOME /.m2:/app/.m2" \
2427 -v " $( pwd) /toolbox.sh:/app/toolbox.sh" \
2528 -v " $( pwd) /utils_bash.sh:/app/utils_bash.sh" \
2629 -v " $( pwd) /.default.docker.env:/app/.default.docker.env" \
30+ -v " $( pwd) /docker-compose.yml:/app/docker-compose.yml" \
31+ -v " $( pwd) /Dockerfile:/app/Dockerfile" \
2732 -v " $( pwd) /pom.xml:/app/pom.xml" \
33+ -v " $( pwd) /src:/app/src" \
34+ -v " $( pwd) /target:/app/target:rw" \
2835 -v " $( pwd) /pytest.ini:/app/pytest.ini" \
2936 -v " $( pwd) /mkdocs.yml:/app/mkdocs.yml" \
3037 -v " $( pwd) /docs:/app/docs" \
You can’t perform that action at this time.
0 commit comments