Resolve backend development for new contributors#135
Resolve backend development for new contributors#135pratham15541 wants to merge 5 commits intoomegaup:mainfrom
Conversation
pabo99
left a comment
There was a problem hiding this comment.
Could you add the two commands you included in the description to the README?
|
Hi @pabo99, I’ve made the changes. Could you please review and let me know if anything else needs to be updated? |
e166d73 to
dfbfdd2
Compare
|
@pratham15541 if this PR is updating the base image, why is it creating a dockerfile instead of updating an existing one? |
|
Hi @heduenas, Updating the base image introduced multiple breaking changes— Fixing this required restructuring the build steps (installing |
|
Hi @heduenas, I’ve prepared a patched version that looks like this. However, it currently does not work for ARM builds. Since the image relies on CGO dependencies (libgit2 / git2go) with static linking, the ARM part cannot be built with For now, I’ve disabled/skipped the ARM-related steps. Please let me know if you’d prefer a different approach for handling ARM support. Additionally, my version is intentionally kept simpler, so I opted to add a new file instead of modifying the existing one extensively, which could have impacted other parts of the setup. That said, we can definitely optimize the image further if needed. Also, for handling multiple architectures, it may be better to use a multi-stage build with Docker buildx instead of manually mixing architectures. CGO-dependent builds can be kept for supported targets, while disabling CGO for cross-compiled ones. Docker.prebuildFROM golang:1.22-bullseye
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake pkg-config \
libssl-dev zlib1g-dev libssh2-1-dev \
libgcrypt-dev libgpg-error-dev \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross \
default-jre \
git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /root
RUN git clone https://github.com/libgit2/libgit2.git \
&& cd libgit2 \
&& git checkout v1.3.0 \
\
&& echo "--- Building shared library ---" \
&& cmake -B build-shared -S . \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
&& cmake --build build-shared -j$(nproc) \
&& cmake --install build-shared \
\
&& echo "--- Building static library ---" \
&& cmake -B build-static -S . \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_BUILD_TYPE=Release \
&& cmake --build build-static -j$(nproc) \
&& cmake --install build-static \
\
&& ldconfig
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
WORKDIR /go/src/github.com/omegaup/quark
COPY go.mod go.sum ./
RUN go mod downloadDocker.buildFROM omegaup/quark-prebuild
WORKDIR /go/src/github.com/omegaup/quark
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ENV STATIC_LIBS="-lgit2 -lssl -lcrypto -ldl -lssh2 -lgcrypt -lgpg-error -lz"
RUN go test -c github.com/omegaup/quark/common -o bin/common_test && \
go test -c github.com/omegaup/quark/runner -o bin/runner_test && \
go test -c github.com/omegaup/quark/grader -o bin/grader_test && \
go build --ldflags "-extldflags \"-static ${STATIC_LIBS}\"" -o bin/grader github.com/omegaup/quark/cmd/omegaup-grader && \
go build --ldflags "-extldflags \"-static ${STATIC_LIBS}\"" -o bin/validator github.com/omegaup/quark/cmd/validator && \
go build --ldflags "-extldflags \"-static ${STATIC_LIBS} -lpthread\"" -o bin/benchmark github.com/omegaup/quark/cmd/benchmark && \
go build --ldflags "-extldflags \"-static ${STATIC_LIBS} -lpthread\"" -o bin/runner github.com/omegaup/quark/cmd/omegaup-runnerI’m happy to update the existing Dockerfile instead if that’s preferred, and can merge these changes there while ensuring nothing else breaks. |
|
Thanks for the detailed context @pratham15541! Sounds good to keep these changes in a separate file and I don't think we need to worry about different architectures, at least for now. |
Old Docker setup was failing for new contributors due to outdated base image.
Replaced with a reproducible Go 1.22 + libgit2 environment.
To build:
docker build -f Dockerfile.latest-build -t quark-test .To run test:
docker run --rm -it -v "$PWD:/app" -w /app quark-test go test ./...Fixes: #134