Skip to content

Commit

Permalink
fix(dockerfile): fix missing spdk and longhornctl
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Su <[email protected]>
  • Loading branch information
derekbit committed Jul 12, 2024
1 parent 27eee49 commit 1550511
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ RUN zypper -n install curl awk docker && \

RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}

# Docker Builx: The docker version in dapper is too old to have buildx. Install it manually.
RUN curl -sSfLO https://github.com/docker/buildx/releases/download/v0.13.1/buildx-v0.13.1.linux-${ARCH} && \
chmod +x buildx-v0.13.1.linux-${ARCH} && \
mv buildx-v0.13.1.linux-${ARCH} /usr/local/bin/buildx

ENV SPDK_COMMIT_ID 4542f9b14010fc7192d42e05adaafc2ae863bac5
RUN cd /usr/src && \
git clone https://github.com/longhorn/spdk.git /spdk && \
Expand Down
7 changes: 4 additions & 3 deletions dapper/package
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ if [ ! -e ./bin/longhornctl ]; then
fi

# Copy SPDK scripts from the dapper container
mkdir -p ./spdk
cp -rf /spdk/scripts ./spdk/
mkdir -p /spdk
cp -rf /spdk/scripts spdk

# Build image
docker build -t "${IMAGE}" -f package/Dockerfile .
buildx build --load -t ${IMAGE} -f package/Dockerfile .

echo Built "${IMAGE}"
# shellcheck disable=SC2086
echo ${IMAGE} > ./bin/latest_image
14 changes: 13 additions & 1 deletion package/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
# syntax=docker/dockerfile:1.8.1

FROM registry.suse.com/bci/bci-base:15.6

ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" != "linux/amd64" ] && [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
echo "Error: Unsupported TARGETPLATFORM: $TARGETPLATFORM" && \
exit 1; \
fi

ENV ARCH ${TARGETPLATFORM#linux/}

RUN zypper -n ref && \
zypper update -y

RUN zypper -n install jq && \
rm -rf /var/cache/zypp/*

COPY bin /usr/local/bin/
COPY bin/longhornctl-linux-${ARCH} /usr/local/bin/longhornctl
COPY bin/longhornctl-local-linux-${ARCH} /usr/local/bin/longhornctl-local

COPY spdk /spdk

CMD ["longhornctl"]

0 comments on commit 1550511

Please sign in to comment.