Some improvements and bug fixes for arm64 support

1. Use 18.04 instead of 22.04 as JSW has issues running on 22.04 currently
2. Push to test tag if build.sh runs without release param
3. Improve agent entrypoint to make it able to respond to ctrl-c when running in console mode
This commit is contained in:
OneDev 2023-01-26 09:29:26 +00:00
parent 3d0af7546e
commit 5d67e72d9d
7 changed files with 23 additions and 15 deletions

View File

@ -1,11 +1,11 @@
# Build the docker image for onedev agent # Build the docker image for onedev agent
FROM ubuntu:22.04 AS build FROM ubuntu:18.04 AS build
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://get.docker.com | sh RUN curl -fsSL https://get.docker.com | sh
FROM ubuntu:22.04 FROM ubuntu:18.04
COPY agent /agent COPY agent /agent
COPY entrypoint_agent.sh /agent/bin/entrypoint.sh COPY entrypoint-agent.sh /root/bin/entrypoint.sh
COPY --from=build /usr/bin/docker /usr/local/bin/docker COPY --from=build /usr/bin/docker /usr/local/bin/docker
RUN apt-get update && apt-get install -y locales curl git git-lfs openjdk-11-jre-headless && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y locales curl git git-lfs openjdk-11-jre-headless && rm -rf /var/lib/apt/lists/*
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
@ -15,4 +15,4 @@ ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8 ENV LC_ALL en_US.UTF-8
WORKDIR /agent/bin WORKDIR /agent/bin
RUN ["touch", "/agent/IN_DOCKER"] RUN ["touch", "/agent/IN_DOCKER"]
CMD ["/agent/bin/entrypoint.sh"] CMD ["/root/bin/entrypoint.sh"]

View File

@ -1,12 +1,13 @@
# Build the docker image for onedev server # Build the docker image for onedev server
FROM ubuntu:22.04 AS build FROM ubuntu:18.04 AS build
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://get.docker.com | sh RUN curl -fsSL https://get.docker.com | sh
FROM ubuntu:22.04 FROM ubuntu:18.04
ARG TARGETPLATFORM=linux/amd64 ARG TARGETPLATFORM=linux/amd64
COPY app /app COPY app /app
COPY entrypoint.sh idle.sh /root/bin/ COPY entrypoint-server.sh /root/bin/entrypoint.sh
COPY idle.sh /root/bin/
RUN apt-get update && apt-get install -y locales iproute2 curl git git-lfs openjdk-11-jre-headless && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y locales iproute2 curl git git-lfs openjdk-11-jre-headless && rm -rf /var/lib/apt/lists/*
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen locale-gen

View File

@ -20,7 +20,11 @@ cp sandbox/site/lib/mysql* sandbox/site/lib/postgresql* docker/app/site/lib
docker buildx create --name builder docker buildx create --name builder
docker buildx use builder docker buildx use builder
docker buildx build --push --platform linux/amd64,linux/arm64 -f docker/Dockerfile.server -t 1dev/server:$buildVersion -t 1dev/server:latest docker
cp -r agent docker/ cp -r agent docker/
docker buildx build --push --platform linux/amd64,linux/arm64 -f docker/Dockerfile.agent -t 1dev/agent:latest docker if [ "$1" != "release" ] ; then
docker buildx build --push --platform linux/amd64,linux/arm64 -f docker/Dockerfile.server -t 1dev/server:test docker
docker buildx build --push --platform linux/amd64,linux/arm64 -f docker/Dockerfile.agent -t 1dev/agent:test docker
else
docker buildx build --push --platform linux/amd64,linux/arm64 -f docker/Dockerfile.server -t 1dev/server:$buildVersion -t 1dev/server:latest docker
docker buildx build --push --platform linux/amd64,linux/arm64 -f docker/Dockerfile.agent -t 1dev/agent:latest docker
fi

Binary file not shown.

View File

@ -12,12 +12,15 @@ trap _sigterm SIGTERM
trap _sigterm SIGINT trap _sigterm SIGINT
UNAME=`uname -m` UNAME=`uname -m`
CPUARCH=""
if [[ $UNAME == "x86_64" ]]; then if [[ $UNAME == "aarch64" ]]; then
CPUARCH="x86-64"
elif [[ $UNAME == "aarch64" ]]; then
CPUARCH="arm-64" CPUARCH="arm-64"
else
CPUARCH="x86-64"
fi fi
/agent/boot/wrapper-linux-$CPUARCH /agent/conf/wrapper.conf cd /agent/boot
./wrapper-linux-$CPUARCH /agent/conf/wrapper.conf &
child=$!
wait "$child"

Binary file not shown.