Commit 1f8c44dc authored by Marcel Huber's avatar Marcel Huber
Browse files

Merge branch 'feature/BuildAndDeployCevelopImage' into develop

parents fbce8dad 0d0badf4
Pipeline #52045 passed with stages
in 23 minutes and 40 seconds
.git
README.md
*.swp
.project
LICENSE
*.gz
.gitlab-ci.yml
CHANGELOG.adoc
export IMAGE_REGISTRY=${CI_REGISTRY_IMAGE:-registry.loc}
export IMAGE_TAG=${IMAGE_TAG:-latest}
export IMAGE_TAG_BUILD=${IMAGE_REGISTRY}/coast-build:${IMAGE_TAG}
export IMAGE_TAG_CEVELOP=${IMAGE_REGISTRY}/coast-build-cevelop:${IMAGE_TAG}
export LABEL_BUILD_DATE=${LABEL_BUILD_DATE}
export LABEL_DESCRIPTION="COAST build tools image"
export LABEL_LICENSE=MIT
export LABEL_MAINTAINER=${GITLAB_USER_EMAIL:-marcel.huber@ost.ch}
export LABEL_NAME=${CI_PROJECT_NAME:-docker-coast-build}
export LABEL_SCHEMA_VERSION=1.0
export LABEL_URL=${CI_PROJECT_URL:-https://gitlab.dev.ifs.hsr.ch:ifs/docker-coast-build}
export LABEL_VCS_REF=${CI_COMMIT_SHA}
export LABEL_VCS_URL=${CI_PROJECT_URL:-https://gitlab.dev.ifs.hsr.ch:ifs/docker-coast-build}
export LABEL_VENDOR=${IMAGE_VENDOR:-IFS Institute For Software}
export LABEL_VERSION=${LABEL_VERSION:-0.0.1}
variables:
DESCRIPTION: "COAST build tools image"
IMAGE_NAME_COMMIT_REF: "$CI_REGISTRY_IMAGE/coast-build:$CI_COMMIT_REF_SLUG"
IMAGE_NAME_COMMIT_TAG: "$CI_REGISTRY_IMAGE/coast-build:$CI_COMMIT_TAG"
IMAGE_NAME_LATEST: "$CI_REGISTRY_IMAGE/coast-build:latest"
IMAGE_NAME_REMOTE: "instituteforsoftware/coast-build"
IMAGE_VENDOR: "IFS Institute For Software"
REMOTE_REGISTRY: "instituteforsoftware"
IMAGE_REGISTRY: "$CI_REGISTRY_IMAGE"
stages:
- envtest
- build
- test
- deploy
default:
image: docker:latest
tags:
- docker
services:
- name: docker:stable-dind
alias: docker
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login --username "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- docker image ls
Envtest:
stage: envtest
variables:
LABEL_VERSION: "$${CI_COMMIT_TAG:-$$CI_COMMIT_REF_NAME}"
LABEL_VERSIONx: "${CI_COMMIT_TAG:-$CI_COMMIT_REF_NAME}"
IMAGE_TAG: $CI_COMMIT_REF_SLUG
before_script: []
script:
- export LABEL_BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
LABEL_VERSIONy="${CI_COMMIT_TAG:-$CI_COMMIT_REF_NAME}"
- eval echo "lv:$LABEL_VERSION lvx:$LABEL_VERSIONx lvy:$LABEL_VERSIONy"
- set -x
- . .env
- eval . .env
- ls $LABEL_VERSION $LABEL_VERSIONx $LABEL_VERSIONy || true
- eval ls $LABEL_VERSION $LABEL_VERSIONx $LABEL_VERSIONy || true
Build:
stage: build
tags:
- docker
variables:
IMAGE_TAG: $CI_COMMIT_REF_SLUG
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --pull --no-cache
--label maintainer="$GITLAB_USER_EMAIL"
--label org.label-schema.build-date="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
--label org.label-schema.description="$DESCRIPTION"
--label org.label-schema.license="MIT"
--label org.label-schema.name="$CI_PROJECT_NAME"
--label org.label-schema.schema-version="1.0"
--label org.label-schema.url="$CI_PROJECT_URL"
--label org.label-schema.vcs-ref="$CI_COMMIT_SHA"
--label org.label-schema.vcs-url="$(echo $CI_REPOSITORY_URL | sed 's|gitlab-ci-token[^@]*@||')"
--label org.label-schema.vendor="${IMAGE_VENDOR:-$CI_PROJECT_NAMESPACE}"
--label org.label-schema.version="${CI_COMMIT_TAG:-$CI_COMMIT_REF_NAME}"
--tag=$IMAGE_NAME_COMMIT_REF
- export LABEL_BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
LABEL_VERSION="${CI_COMMIT_TAG:-$CI_COMMIT_REF_NAME}"
- . .env
- docker build --pull
--build-arg BUILDKIT_INLINE_CACHE=1
--cache-from $IMAGE_TAG_BUILD
--label maintainer="${LABEL_MAINTAINER}"
--label org.label-schema.build-date="${LABEL_BUILD_DATE}"
--label org.label-schema.description="${LABEL_DESCRIPTION}"
--label org.label-schema.license="${LABEL_LICENSE}"
--label org.label-schema.name="${LABEL_NAME}"
--label org.label-schema.schema-version="${LABEL_SCHEMA_VERSION}"
--label org.label-schema.url="${LABEL_URL}"
--label org.label-schema.vcs-ref="${LABEL_VCS_REF}"
--label org.label-schema.vcs-url="${LABEL_VCS_URL}"
--label org.label-schema.vendor="${LABEL_VENDOR}"
--label org.label-schema.version="${LABEL_VERSION}"
--tag=$IMAGE_TAG_BUILD
--file=Dockerfile
.
- docker push $IMAGE_NAME_COMMIT_REF
- docker push $IMAGE_TAG_BUILD
- docker build --pull
--build-arg BUILDKIT_INLINE_CACHE=1
--build-arg CEVELOP_FROM_IMAGE=$IMAGE_TAG_BUILD
--cache-from $IMAGE_TAG_CEVELOP
--label maintainer="${LABEL_MAINTAINER}"
--label org.label-schema.build-date="${LABEL_BUILD_DATE}"
--label org.label-schema.description="Cevelop IDE based on COAST build image"
--label org.label-schema.license="${LABEL_LICENSE}"
--label org.label-schema.name="${LABEL_NAME}"
--label org.label-schema.schema-version="${LABEL_SCHEMA_VERSION}"
--label org.label-schema.url="${LABEL_URL}"
--label org.label-schema.vcs-ref="${LABEL_VCS_REF}"
--label org.label-schema.vcs-url="${LABEL_VCS_URL}"
--label org.label-schema.vendor="${LABEL_VENDOR}"
--label org.label-schema.version="${LABEL_VERSION}"
--tag=$IMAGE_TAG_CEVELOP
--file=Dockerfile.cevelop
.
- docker push $IMAGE_TAG_CEVELOP
Test unprivileged:
stage: test
tags:
- docker
script:
- docker run --rm --user docky $IMAGE_NAME_COMMIT_REF bash -c "python -V; pip --disable-pip-version-check list"
- export IMAGE_TAG_BUILD=${IMAGE_REGISTRY:-registry.loc}/coast-build:${CI_COMMIT_REF_SLUG}
- docker pull $IMAGE_TAG_BUILD
- docker run --rm --user docky $IMAGE_TAG_BUILD bash -c "echo I am \$(id -un); python -V; pip --disable-pip-version-check list"
Test privileged:
stage: test
tags:
- docker
script:
- docker run --rm $IMAGE_NAME_COMMIT_REF bash -c "python -V; pip --disable-pip-version-check list"
- export IMAGE_TAG_BUILD=${IMAGE_REGISTRY:-registry.loc}/coast-build:${CI_COMMIT_REF_SLUG}
- docker pull $IMAGE_TAG_BUILD
- docker run --rm $IMAGE_TAG_BUILD bash -c "echo I am \$(id -un); python -V; pip --disable-pip-version-check list"
Test native image:
stage: test
image: $IMAGE_NAME_COMMIT_REF
tags:
- docker
image: ${CI_REGISTRY_IMAGE}/coast-build:${CI_COMMIT_REF_SLUG}
before_script: []
script:
- python -V
- pip --disable-pip-version-check list
Tag:
stage: deploy
only:
- tags
tags:
- docker
rules:
- if: $CI_COMMIT_TAG
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $IMAGE_NAME_COMMIT_REF
- docker image tag $IMAGE_NAME_COMMIT_REF $IMAGE_NAME_COMMIT_TAG
- docker push $IMAGE_NAME_COMMIT_TAG
- test -n "$DOCKER_USER" -a -n "$IMAGE_NAME_REMOTE" && {
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
docker tag $IMAGE_NAME_COMMIT_REF $IMAGE_NAME_REMOTE:$CI_COMMIT_TAG;
docker push $IMAGE_NAME_REMOTE:$CI_COMMIT_TAG;
- set -x
- export IMAGE_TAG_BUILD=${IMAGE_REGISTRY:-registry.loc}/coast-build:${CI_COMMIT_REF_SLUG}
IMAGE_TAG_BUILD_TAG=${IMAGE_REGISTRY:-registry.loc}/coast-build:${CI_COMMIT_TAG}
IMAGE_TAG_BUILD_TAG_REMOTE=${REMOTE_REGISTRY:-registry.loc}/coast-build:${CI_COMMIT_TAG}
IMAGE_TAG_CEVELOP=${IMAGE_REGISTRY:-registry.loc}/coast-build-cevelop:${CI_COMMIT_REF_SLUG}
IMAGE_TAG_CEVELOP_TAG=${IMAGE_REGISTRY:-registry.loc}/coast-build-cevelop:${CI_COMMIT_TAG}
IMAGE_TAG_CEVELOP_TAG_REMOTE=${REMOTE_REGISTRY:-registry.loc}/coast-build-cevelop:${CI_COMMIT_TAG}
- docker pull $IMAGE_TAG_BUILD
- docker pull $IMAGE_TAG_CEVELOP
- docker image tag $IMAGE_TAG_BUILD $IMAGE_TAG_BUILD_TAG
- docker image tag $IMAGE_TAG_CEVELOP $IMAGE_TAG_CEVELOP_TAG
- docker push $IMAGE_TAG_BUILD_TAG
- docker push $IMAGE_TAG_CEVELOP_TAG
- test -n "$DOCKER_USER" -a -n "$REMOTE_REGISTRY" && {
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin;
docker tag $IMAGE_TAG_BUILD_TAG $IMAGE_TAG_BUILD_TAG_REMOTE;
docker tag $IMAGE_TAG_CEVELOP_TAG $IMAGE_TAG_CEVELOP_TAG_REMOTE;
docker push $IMAGE_TAG_BUILD_TAG_REMOTE;
docker push $IMAGE_TAG_CEVELOP_TAG_REMOTE;
} || true
- test -n "$MICROBADGER_UPDATE_HOOK" && {
wget --post-data "" $MICROBADGER_UPDATE_HOOK;
......@@ -82,20 +136,29 @@ Tag:
Deploy latest image:
stage: deploy
only:
- tags
when: manual
tags:
- docker
rules:
- if: '$CI_COMMIT_TAG && $CI_COMMIT_BRANCH == "master"'
when: manual
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $IMAGE_NAME_COMMIT_REF
- docker image tag $IMAGE_NAME_COMMIT_REF $IMAGE_NAME_LATEST
- docker push $IMAGE_NAME_LATEST
- test -n "$DOCKER_USER" -a -n "$IMAGE_NAME_REMOTE" && {
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
docker tag $IMAGE_NAME_COMMIT_REF $IMAGE_NAME_REMOTE:latest;
docker push $IMAGE_NAME_REMOTE:latest;
- export IMAGE_TAG_BUILD=${IMAGE_REGISTRY:-registry.loc}/coast-build:${CI_COMMIT_REF_SLUG}
IMAGE_TAG_BUILD_TAG=${IMAGE_REGISTRY:-registry.loc}/coast-build:${CI_COMMIT_TAG}
IMAGE_TAG_BUILD_LATEST=${IMAGE_REGISTRY:-registry.loc}/coast-build:latest
IMAGE_TAG_BUILD_LATEST_REMOTE=${REMOTE_REGISTRY:-registry.loc}/coast-build:latest
IMAGE_TAG_CEVELOP=${IMAGE_REGISTRY:-registry.loc}/coast-build-cevelop:${CI_COMMIT_REF_SLUG}
IMAGE_TAG_CEVELOP_LATEST=${IMAGE_REGISTRY:-registry.loc}/coast-build-cevelop:latest
IMAGE_TAG_CEVELOP_LATEST_REMOTE=${REMOTE_REGISTRY:-registry.loc}/coast-build-cevelop:latest
- docker pull $IMAGE_TAG_BUILD
- docker pull $IMAGE_TAG_CEVELOP
- docker image tag $IMAGE_TAG_BUILD $IMAGE_TAG_BUILD_LATEST
- docker image tag $IMAGE_TAG_CEVELOP $IMAGE_TAG_CEVELOP_LATEST
- docker push $IMAGE_TAG_BUILD_LATEST
- docker push $IMAGE_TAG_CEVELOP_LATEST
- test -n "$DOCKER_USER" -a -n "$REMOTE_REGISTRY" && {
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin;
docker tag $IMAGE_TAG_BUILD_LATEST $IMAGE_TAG_BUILD_LATEST_REMOTE;
docker tag $IMAGE_TAG_CEVELOP_LATEST $IMAGE_TAG_CEVELOP_LATEST_REMOTE;
docker push $IMAGE_TAG_BUILD_LATEST_REMOTE;
docker push $IMAGE_TAG_CEVELOP_LATEST_REMOTE;
} || true
- test -n "$MICROBADGER_UPDATE_HOOK" && {
wget --post-data "" $MICROBADGER_UPDATE_HOOK;
......
# Use ubuntu xenial as long as we need gcc-4.x compilers to test with
FROM ubuntu:16.04
RUN dpkg --add-architecture i386 \
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --yes --quiet --no-install-recommends \
curl software-properties-common wget \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BA9EF27F \
&& add-apt-repository --yes ppa:ubuntu-toolchain-r/test \
&& curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash \
&& DEBIAN_FRONTEND=noninteractive apt-get install --yes --quiet --no-install-recommends \
file git git-lfs gosu iproute2 less npm shared-mime-info sudo tig tzdata vim doxygen graphviz fonts-liberation xz-utils tree \
&& apt-get purge -y software-properties-common; apt-get autoremove --purge -y; apt-get autoclean -y; apt-get clean -y; rm -rf /var/lib/apt/lists/*
RUN printf "\
APT::Get::Assume-Yes "true";\n\
APT::Get::Fix-Broken "true";\n\
APT::Get::Fix-Missing "true";\n\
APT::Install-Recommends "false";\n\
APT::Install-Suggests "false";\n\
APT::Get::Show-Upgraded "true";\n\
APT::Get::Upgrade-Allow-New "true";\n\
APT::Get::Upgrade "true";\n\
APT::Get::Purge "true";\n\
APT::Get::AutomaticRemove "true";\n\
quiet;\n" > /etc/apt/apt.conf.d/coast-options
RUN dpkg --add-architecture i386\
&& apt-get update && apt-get install \
curl software-properties-common wget\
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BA9EF27F\
&& add-apt-repository --yes ppa:ubuntu-toolchain-r/test\
&& add-apt-repository --yes ppa:git-core/ppa\
&& add-apt-repository --yes ppa:martin-frost/thoughtbot-rcm\
&& curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash\
&& curl -sL https://deb.nodesource.com/setup_14.x | bash\
&& apt-get update && apt-get install\
file git git-lfs gosu iproute2 less nodejs shared-mime-info sudo tig tzdata vim doxygen xz-utils tree direnv\
graphviz fonts-liberation ranger rcm openssh-client man bash-completion\
&& apt-get purge software-properties-common; apt-get autoremove; apt-get autoclean; apt-get clean; rm -rf /var/lib/apt/lists/*
RUN printf "\n\
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main\n\
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main\n\
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main\n\
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main\n\
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main\n\
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main\n\
" > /etc/apt/sources.list.d/apt.llvm.org.list \
&& curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add -
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --yes --quiet --no-install-recommends \
python-pip python-virtualenv python-all-dev virtualenv tox \
g++-multilib g++-4.4-multilib g++-4.6-multilib g++-4.7-multilib g++-4.8-multilib g++-5-multilib g++-6-multilib g++-8-multilib g++-9-multilib \
gdb lldb-8 llvm-8 llvm-8-dev \
clang-modernize-3.7 clang-6.0 clang-7 clang-8 clang-9 clang-format \
libssl-dev libssl-dev:i386 libldap2-dev libsasl2-dev libaio1 libaio1:i386 \
&& apt-get autoremove --purge -y; apt-get autoclean -y; apt-get clean -y; rm -rf /var/lib/apt/lists/*
RUN npm i --global diff-so-fancy bats
RUN ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime && rm /etc/timezone
RUN apt-get update && apt-get install\
python-pip python-virtualenv python-all-dev virtualenv python-setuptools python-wheel tox\
g++-multilib g++-4.4-multilib g++-4.6-multilib g++-4.7-multilib g++-4.8-multilib g++-5-multilib g++-9-multilib gdb gdbserver\
libssl-dev libssl-dev:i386 libldap2-dev libsasl2-dev libaio1 libaio1:i386\
&& apt-get autoremove; apt-get autoclean; apt-get clean; rm -rf /var/lib/apt/lists/*
# setup gcc alternatives
RUN for n in 4.4 4.6 4.7 4.8 5 6 8 9; do \
RUN for n in 4.4 4.6 4.7 4.8 5 9; do\
_prio=$(awk "BEGIN { print $n*10; }");\
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$n $_prio;\
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-$n $_prio;\
......@@ -39,22 +47,49 @@ RUN for n in 4.4 4.6 4.7 4.8 5 6 8 9; do \
update-alternatives --set g++ /usr/bin/g++-9;\
update-alternatives --set gcc /usr/bin/gcc-9
ENV USERNAME=docky \
EDITOR=vim \
RUN printf "\n\
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main\n\
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main\n\
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-11 main\n\
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-11 main\n\
" > /etc/apt/sources.list.d/apt.llvm.org.list\
&& curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add -
RUN apt-get update && apt-get install\
lldb-12 llvm-dev clang-modernize-3.7 clang clang-format\
&& clang-format --version\
&& apt-get autoremove; apt-get autoclean; apt-get clean; rm -rf /var/lib/apt/lists/*
ENV USER=docky\
EDITOR=vim\
LC_ALL=C
ENV HOMEDIR=/home/$USERNAME
RUN useradd --create-home --shell /bin/bash $USERNAME
RUN npm i --global diff-so-fancy bats
ENV HOMEDIR=/$USER
RUN useradd --create-home --home-dir=$HOMEDIR --shell /bin/bash $USER
RUN curl -sSL https://storage.googleapis.com/shellcheck/shellcheck-stable.linux.x86_64.tar.xz | tar xJf - -C /usr/local/bin --strip-components=1
RUN curl -fsSL https://starship.rs/install.sh | FORCE=1 bash
RUN curl -sSL https://raw.githubusercontent.com/zaquestion/lab/master/install.sh | bash\
&& lab completion bash >/etc/bash_completion.d/lab
RUN wget -q https://raw.githubusercontent.com/petervanderdoes/gitflow-avh/develop/contrib/gitflow-installer.sh\
&& bash gitflow-installer.sh install develop; rm gitflow-installer.sh
RUN (_d=$(mktemp -d);\
wget --quiet -O - https://github.com/github/hub/releases/download/v2.14.2/hub-linux-amd64-2.14.2.tgz |\
tar xzf - --strip-components=1 -C $_d\
&& cd $_d\
&& ./install\
&& cp -p etc/hub.bash_completion.sh /etc/bash_completion.d/hub\
&& chown -R root:root /etc/bash_completion.d/\
&& cd\
&& rm -rf $_d)
ADD gitconfig $HOMEDIR/.config/git/config
RUN chown -R $USERNAME:$USERNAME $HOMEDIR/.config
RUN chown -R $USER:$USER $HOMEDIR/.config
RUN printf "docky ALL=(ALL) ALL\n\
Defaults:$USERNAME !authenticate,!pam_session,env_reset\n" > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME
Defaults:$USER !authenticate,!pam_session,env_reset\n" > /etc/sudoers.d/$USER\
&& chmod 0440 /etc/sudoers.d/$USER
ENV SOURCEDIR=/src \
BUILDOUTPUTDIR=/generated \
VENVDIR=$HOMEDIR/.v27scons \
ENV SOURCEDIR=/src\
BUILDOUTPUTDIR=/generated\
VENVDIR=$HOMEDIR/.v27scons\
BASH_ENV=$HOMEDIR/.bash_aliases
RUN printf "[global]\n\
......@@ -63,14 +98,22 @@ index-url=https://pypi.org/simple\n\
extra-index-url=https://devpi.coast-project.org/coast/CoastSconsider/+simple\n\
" > /etc/pip.conf
USER $USERNAME
USER $USER
RUN git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"
RUN mkdir -p ~/.pip\
RUN mkdir -p $HOMEDIR/.pip\
&& sed -i -r '/^case \$-/,/^esac/ d' $HOMEDIR/.bashrc\
&& echo "test -d \"\$VENVDIR\" && . \$VENVDIR/bin/activate" >> $HOMEDIR/.bash_aliases
RUN printf '\n\
function set_win_title(){\n\
echo -ne "\\033]0; $(id -nu)@$(uname -n):$(pwd) \\007"\n\
}\n\
starship_precmd_user_func="set_win_title"\n\
eval "$(starship init bash)"\n\
' >> $HOMEDIR/.bashrc
RUN virtualenv $VENVDIR\
&& . $VENVDIR/bin/activate\
&& pip install --upgrade pip
......
ARG CEVELOP_FROM_IMAGE=registry.loc/coast-build:latest
FROM $CEVELOP_FROM_IMAGE
ARG CEVELOP_FROM_IMAGE
RUN echo "using from image [$CEVELOP_FROM_IMAGE]"
RUN apt-get update && apt-get install\
software-properties-common\
&& add-apt-repository --yes ppa:openjdk-r/ppa\
&& apt-get update && apt-get install\
openjdk-11-jre-headless java-common default-jre default-java-plugin libwebkitgtk-3.0-0\
fonts-dejavu-extra ttf-bitstream-vera evince\
&& apt-get purge software-properties-common; apt-get autoremove; apt-get autoclean; apt-get clean; rm -rf /var/lib/apt/lists/*
ARG ECLIPSE_URL=https://www.cevelop.com/cevelop/downloads/cevelop-1.14.1-202002280945-linux.gtk.x86_64.tar.gz
ENV WORKSPACE_DIR=/workspace\
ECLIPSE_DIR=/opt/cevelop\
ECLIPSE_STARTSCRIPT=cevelop.sh
RUN mkdir -p /opt && wget -q -O - $ECLIPSE_URL | tar -xz -C /opt
RUN sed -i -r -e 's|http\\:[_/]+https\\:|https\\:|g'\
$(grep -Hrln "__https" $ECLIPSE_DIR)
RUN sed -i -e '/MaxPermSize/ d'\
# -e '/ALL-SYSTEM/ d'\
$ECLIPSE_DIR/cevelop.ini
# patch profile to allow updating [ej]git
RUN for f in $(ls -c1 $ECLIPSE_DIR/p2/org.eclipse.equinox.p2.engine/profileRegistry/DefaultProfile.profile/*.profile.gz | sort -nr | head -n1); do\
mv $f $f.bk;\
gzip -d -c $f.bk |\
sed -r -e 's|,5.6.1.202002131546-r|,5.10.0|g' -e 's|,5.7.0|,5.10.1|g' |\
gzip - > $f;\
done
ADD $ECLIPSE_STARTSCRIPT $ECLIPSE_DIR
RUN chmod +x $ECLIPSE_DIR/$ECLIPSE_STARTSCRIPT
RUN $ECLIPSE_DIR/cevelop -nosplash -application org.eclipse.equinox.p2.director\
-repository http://download.eclipse.org/releases/2019-12,https://download.eclipse.org/egit/updates\
-installIU org.eclipse.egit.feature.group,org.eclipse.jgit.feature.group,org.eclipse.jgit.http.apache.feature.group,org.eclipse.jgit.ssh.apache.feature.group,org.eclipse.jgit.lfs.feature.group
RUN $ECLIPSE_DIR/cevelop -nosplash -application org.eclipse.equinox.p2.director\
-repository http://sconsolidator.com/update,https://www.cevelop.com/update/1.14.0\
-installIU ch.hsr.ifs.sconsolidator.feature.feature.group,com.cevelop.gslator.feature.feature.group,com.cevelop.includator.feature.feature.group,com.cevelop.intwidthfixator.feature.feature.group
RUN $ECLIPSE_DIR/cevelop -nosplash -application org.eclipse.equinox.p2.director\
-repository https://raw.githubusercontent.com/iloveeclipse/plugins/latest/\
-installIU AnyEditTools.feature.group
RUN $ECLIPSE_DIR/cevelop -nosplash -application org.eclipse.equinox.p2.director\
-repository https://dl.bintray.com/de-jcup/asciidoctoreditor\
-installIU de.jcup.asciidoctoreditor.feature.group
RUN $ECLIPSE_DIR/cevelop -nosplash -application org.eclipse.equinox.p2.director\
-repository http://www.cppstyle.com/oxygen\
-installIU org.wangzw.cppstyle.feature.feature.group
RUN $ECLIPSE_DIR/cevelop -nosplash -application org.eclipse.equinox.p2.director\
-repository https://editorconfig-eclipse.github.io/repository\
-installIU editorconfig-eclipse-feature.feature.group
RUN $ECLIPSE_DIR/cevelop -nosplash -application org.eclipse.equinox.p2.director\
-repository http://download.eclipse.org/releases/2019-12,https://download.eclipse.org/shellwax/releases/1.0.0\
-installIU org.eclipse.shellwax.feature.feature.group
RUN $ECLIPSE_DIR/cevelop -nosplash -application org.eclipse.equinox.p2.director\
-repository https://dl.bintray.com/de-jcup/yamleditor\
-installIU de.jcup.yamleditor.feature.group
RUN $ECLIPSE_DIR/cevelop -nosplash -application org.eclipse.equinox.p2.director\
-repository http://www.pydev.org/updates\
-installIU org.python.pydev.feature.feature.group
RUN mkdir -p $WORKSPACE_DIR
COPY entrypoint-init.d.cevelop /entrypoint-init.d
VOLUME ["$WORKSPACE_DIR", "$SOURCEDIR"]
#!/bin/sh
export CEVELOP_INTRO=false
mkdir -p "$WORKSPACE_DIR"
cd "$SOURCEDIR" && "$ECLIPSE_DIR"/cevelop -consoleLog -data "$WORKSPACE_DIR" "$@"
networks:
default:
attachable: true
services:
build:
build:
context: .
dockerfile: Dockerfile
labels:
maintainer: ${LABEL_MAINTAINER:-marcel.huber@ost.ch}
org.label-schema.build-date: ${LABEL_BUILD_DATE}
org.label-schema.description: ${LABEL_DESCRIPTION}
org.label-schema.license: ${LABEL_LICENSE}
org.label-schema.name: ${LABEL_NAME:-$COMPOSE_PROJECT_NAME}
org.label-schema.schema-version: ${LABEL_SCHEMA_VERSION}
org.label-schema.url: ${LABEL_URL}
org.label-schema.vcs-ref: ${LABEL_VCS_REF}
org.label-schema.vcs-url: ${LABEL_VCS_URL}
org.label-schema.vendor: ${LABEL_VENDOR}
org.label-schema.version: ${LABEL_VERSION}
image: ${IMAGE_REGISTRY:-registry.loc}/coast-build:${IMAGE_TAG:-latest}
cevelop:
build:
args:
CEVELOP_FROM_IMAGE: ${IMAGE_REGISTRY:-registry.loc}/coast-build:${IMAGE_TAG:-latest}
context: .
dockerfile: Dockerfile.cevelop
labels:
maintainer: ${LABEL_MAINTAINER:-marcel.huber@ost.ch}
org.label-schema.build-date: ${LABEL_BUILD_DATE}
org.label-schema.description: "Cevelop IDE based on COAST build image"
org.label-schema.license: ${LABEL_LICENSE}
org.label-schema.name: ${LABEL_NAME:-$COMPOSE_PROJECT_NAME}
org.label-schema.schema-version: ${LABEL_SCHEMA_VERSION}
org.label-schema.url: ${LABEL_URL}
org.label-schema.vcs-ref: ${LABEL_VCS_REF}
org.label-schema.vcs-url: ${LABEL_VCS_URL}
org.label-schema.vendor: ${LABEL_VENDOR}
org.label-schema.version: ${LABEL_VERSION}
environment:
BUILD_ARCHBITS: --archbits=32
BUILD_CFG: --build-cfg=optimized
# BUILD_COMPILERS: --with-cc= --with-cxx=
BUILD_COMPILER_STD: --use-lang-features=gnu++98
BUILD_COMPILER_WARN: --warnlevel=medium
BUILD_EXCLUDE_CACHEDIR: --exclude=$$BUILD_OUTPUT_32 --exclude=$$BUILD_OUTPUT_64
BUILD_IGNORE_MISSING: --ignore-missing
BUILD_JOBS: --jobs=$${BUILD_JOBS_NUM:-10}
BUILD_OUTPUT_32: /tmp/build_32
BUILD_OUTPUT_64: /tmp/build_64
BUILD_OUTPUT_OPT: --baseoutdir=$$BUILD_OUTPUT_32
BUILD_SCONS_CONFIG: --config=force
BUILD_TARGETS: --exclude=testfw/dummytest tests
BUILD_TESTOPT: --usetool=TestfwTransformer
BUILD_WITH_TRACE: --tracemode=1
DISPLAY: :0.0
EX_SCONSFLAGS: $$BUILD_OUTPUT_OPT $$BUILD_EXCLUDE_CACHEDIR $$BUILD_ARCHBITS
$$BUILD_CFG $$BUILD_WITH_TRACE $$BUILD_COMPILERS $$BUILD_COMPILER_STD $$BUILD_COMPILER_WARN
$$BUILD_TESTOPT $$BUILD_JOBS $$BUILD_SCONS_CONFIG $$BUILD_IGNORE_MISSING $$THIRDPARTY_FLAGS
GNAME: users
SSH_AUTH_SOCK: /ssh-agent
START_CEVELOP: 1
THIRDPARTY_DIR: 3rdparty
THIRDPARTY_FLAGS: --with-src-boost=$${THIRDPARTY_DIR}/boost --with-bin-openssl=$${THIRDPARTY_DIR}/openssl
--with-src-zlib=$${THIRDPARTY_DIR}/zlib --with-bin-iplanetLDAP=$${THIRDPARTY_DIR}/iplanet_ldap
--with-bin-oracle=$${THIRDPARTY_DIR}/oracle
# HOMEDIR: /nobody
WORKSPACE_DIR: /workspace/COAST
hostname: cevelop
image: ${IMAGE_REGISTRY:-registry.loc}/coast-build-cevelop:${IMAGE_TAG:-latest}
network_mode: host
stdin_open: true
tty: true
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- $HOME/.Xauthority:/docky/.Xauthority:rw
- $PWD:/src:rw
- $SSH_AUTH_SOCK:/ssh-agent:rw
- cevelop-home:/docky:rw
- cevelop-workspace:/workspace:rw
version: '3.7'
volumes:
cevelop-home: {}
cevelop-workspace: {}
#!/bin/sh
if [ -n "$EX_SCONSFLAGS" ]; then
SCONSFLAGS="$(eval echo "$(eval echo "$EX_SCONSFLAGS")")";
export SCONSFLAGS;
fi;
#!/bin/sh
sudo usermod --uid "$(stat -c "%u" "$SOURCEDIR")" "$USER";
sudo mkdir -p "$WORKSPACE_DIR";
sudo chown -R "$USER" "$HOMEDIR" "$WORKSPACE_DIR";
if [ -n "$GNAME" ]; then
sudo chgrp -R "$GNAME" "$HOMEDIR" "$WORKSPACE_DIR";
sudo gpasswd --add "$USER" "$GNAME";
fi;
#!/bin/sh
if [ -n "$START_CEVELOP" ]; then
gosu "$USER" "$ECLIPSE_DIR/$ECLIPSE_STARTSCRIPT" &
fi
#!/bin/sh
SUDO=$(command -v sudo)
sudo() {
if [ "$(id -u)" -eq "0" ]; then "$@"; else $SUDO "$@"; fi
if [ "$(id -u)" = "0" ]; then "$@"; else $SUDO "$@"; fi
}
SUDO=$(type -fP sudo)
#!/bin/sh
_hostname=entry.from.etc.hosts
_ip=1.2.3.4
grep -q "$_hostname" /etc/hosts || sudo sh -c "printf \"${_ip}\t${_hostname}\n\" >> /etc/hosts"
#!/bin/sh
_hostname=$(hostname)
_ip=127.0.0.1
grep -q "$_hostname" /etc/hosts || sudo sh -c "printf \"${_ip}\t${_hostname}\n\" >> /etc/hosts"
sudo bash -c 'printf "1.2.3.4\tentry.from.etc.hosts\n" >> /etc/hosts'
#!/bin/bash
set -e
# shellcheck source=/dev/null
# Provide a way to customize this image
for f in /entrypoint-init.d/*; do
case "$f" in
......@@ -9,6 +10,6 @@ for f in /entrypoint-init.d/*; do
esac
done
if [ -z "$1" ]; then
if [ "$(id -u)" -eq "0" ]; then exec gosu $USERNAME bash; fi
if [ "$(id -u)" -eq "0" ]; then exec gosu "$USER" bash; fi
fi
exec "$@"