Skip to content

Commit bd2c0af

Browse files
authored
Merge pull request #69 from usernameisnull/add-cond-cli
add conda and mamba cli
2 parents 87f307d + 17c468f commit bd2c0af

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

data-loader.Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -ldflags
2525
FROM python:3.13
2626
ARG JAVA_HOME=/opt/java
2727
ARG HADOOP_HOME=/opt/hadoop
28+
ENV CONDA_DIR=/opt/conda
29+
ENV PATH=$CONDA_DIR/bin:$PATH
2830
ENV JAVA_HOME=${JAVA_HOME} \
2931
HADOOP_HOME=${HADOOP_HOME} \
3032
PATH=${PATH}:${HADOOP_HOME}/bin:${JAVA_HOME}/bin
@@ -43,7 +45,11 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update -yq && \
4345
wget https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.30%2B7/OpenJDK11U-jre_${jre_arch}_linux_hotspot_11.0.30_7.tar.gz -O jre.tar.gz && \
4446
tar -zxf jre.tar.gz -C /opt && \
4547
mv /opt/jdk-11* /opt/java && \
46-
rm jre.tar.gz
48+
rm jre.tar.gz && \
49+
wget -q https://github.com/conda-forge/miniforge/releases/download/26.1.0-0/Miniforge3-26.1.0-0-Linux-$(uname -m).sh -O /tmp/miniforge.sh \
50+
&& bash /tmp/miniforge.sh -b -p $CONDA_DIR \
51+
&& rm /tmp/miniforge.sh \
52+
&& conda clean -afy
4753

4854
COPY --from=builder /workspace/data-loader /usr/local/bin/
4955

@@ -64,5 +70,5 @@ RUN echo "export JAVA_HOME=${JAVA_HOME}" >> ${HADOOP_HOME}/etc/hadoop/hadoop-env
6470
&& find share/hadoop/common/lib/ \
6571
\( -name "jetty-*" -o -name "jersey-*" -o -name "netty-*" \) \
6672
-exec rm -rf {} +
67-
73+
WORKDIR /workspace
6874
ENTRYPOINT ["/usr/local/bin/data-loader"]

internal/pkg/datasources/datasource_conda.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ func renderPipConfig(pipIndexURL string, pipExtraIndexURLs []string) (string, er
373373
return "", err
374374
}
375375

376-
sb.WriteString(fmt.Sprintf("index-url = %s\n", pipIndexURL))
376+
fmt.Fprintf(&sb, "index-url = %s\n", pipIndexURL)
377377
trustedHosts = append(trustedHosts, parsedPipIndexURL.Host)
378378
}
379379
if len(pipExtraIndexURLs) > 0 {
@@ -383,7 +383,7 @@ func renderPipConfig(pipIndexURL string, pipExtraIndexURLs []string) (string, er
383383
return "", err
384384
}
385385

386-
sb.WriteString(fmt.Sprintf("extra-index-url = %s\n", pipExtraIndexURLs[0]))
386+
fmt.Fprintf(&sb, "extra-index-url = %s\n", pipExtraIndexURLs[0])
387387
trustedHosts = append(trustedHosts, parsedExtraIndexURL.Host)
388388
} else {
389389
extraIndexURLs := make([]string, 0, len(pipExtraIndexURLs))
@@ -397,14 +397,18 @@ func renderPipConfig(pipIndexURL string, pipExtraIndexURLs []string) (string, er
397397
trustedHosts = append(trustedHosts, parsedExtraIndexURL.Host)
398398
}
399399

400-
sb.WriteString(fmt.Sprintf("extra-index-url =\n %s\n", strings.Join(extraIndexURLs, "\n ")))
400+
fmt.Fprintf(
401+
&sb,
402+
"extra-index-url =\n %s\n",
403+
strings.Join(extraIndexURLs, "\n "),
404+
)
401405
}
402406
}
403407
if len(trustedHosts) > 0 {
404408
if len(trustedHosts) == 1 {
405-
sb.WriteString(fmt.Sprintf("trusted-host = %s\n", trustedHosts[0]))
409+
fmt.Fprintf(&sb, "trusted-host = %s\n", trustedHosts[0])
406410
} else {
407-
sb.WriteString(fmt.Sprintf("trusted-host =\n %s\n", strings.Join(trustedHosts, "\n ")))
411+
fmt.Fprintf(&sb, "trusted-host =\n %s\n", strings.Join(trustedHosts, "\n "))
408412
}
409413
}
410414

0 commit comments

Comments
 (0)