Update docker script and dockerfile

Using Ubuntu 23 throws an error "groupadd: GID '1000' already exists" when trying to build. Ubuntu 22 works fine.

There should be no difference between building C3 on Ubuntu 22 vs 23.

To avoid issues raised it's best to move to single Ubuntu version that builds the compiler.
This commit is contained in:
Kenta
2023-01-30 20:05:02 +00:00
committed by Christoffer Lerno
parent adf84e38d0
commit 61cc8163f9
2 changed files with 18 additions and 26 deletions

View File

@@ -2,12 +2,12 @@
## build-with-docker.sh
## @author gdm85
##
## Script to build c3c for either Ubuntu 22 or 23.
## Script to build c3c for Ubuntu 22
##
#
if [ $# -ne 1 -a $# -ne 2 ]; then
echo "Usage: build-with-docker.sh (22|23) [Debug|Release]" 1>&2
echo "Usage: build-with-docker.sh [Debug|Release]" 1
exit 1
fi
@@ -22,26 +22,18 @@ if type podman 2>/dev/null >/dev/null; then
IMAGE="localhost/$IMAGE"
fi
if [ -z "$2" ]; then
if [ -z "$1" ]; then
CMAKE_BUILD_TYPE=Debug
else
CMAKE_BUILD_TYPE="$2"
CMAKE_BUILD_TYPE="$1"
fi
TAG="$1"
if [ "$1" = 22 ]; then
UBUNTU_VERSION="22.10"
LLVM_VERSION="15"
elif [ "$1" = 23 ]; then
UBUNTU_VERSION="23.04"
LLVM_VERSION="15"
else
echo "ERROR: expected 22 or 23 as Ubuntu version argument" 1>&2
exit 2
fi
IMAGE="$IMAGE:$TAG"
cd docker && $DOCKER build -t $IMAGE --build-arg UID=$(id -u) --build-arg GID=$(id -g) \
IMAGE="$IMAGE:22"
cd docker && $DOCKER build -t $IMAGE\
--build-arg DEPS="llvm-$LLVM_VERSION-dev liblld-$LLVM_VERSION-dev clang-$LLVM_VERSION libllvm$LLVM_VERSION llvm-$LLVM_VERSION-runtime" \
--build-arg UBUNTU_VERSION="$UBUNTU_VERSION" .
cd ..

View File

@@ -11,6 +11,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && export TERM=xterm && apt-get update
ARG GID=1000
ARG UID=1000
RUN groupadd --gid=$GID c3c && useradd --gid=$GID --uid=$GID --create-home --shell /bin/bash c3c
RUN groupadd -o --gid=$GID c3c && useradd --gid=$GID --uid=$GID --create-home --shell /bin/bash c3c
USER c3c