Skip to content
Snippets Groups Projects
Commit 89d8c2af authored by Marcel Huber's avatar Marcel Huber
Browse files

Initial release of COAST recipes server image

Merge branch 'release/0.9.0'
parents 9674d85b 1cddbb43
Branches
Tags 0.9.0
No related merge requests found
Pipeline #324376 passed
.env 0 → 100644
DOMAINNAME=${DOMAINNAME:-$(dnsdomainname)}
HOSTNAME=${HOSTNAME:-$(hostname)}
# TZ format: https://pubs.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html
TZ=CET-1CEST,M3.5.0,M10.5.0/3
variables:
DESCRIPTION: "COAST Recipes image"
IMAGE_NAME_COMMIT_REF: "$CI_REGISTRY_IMAGE/coast-recipes:$CI_COMMIT_REF_SLUG"
IMAGE_NAME_COMMIT_TAG: "$CI_REGISTRY_IMAGE/coast-recipes:$CI_COMMIT_TAG"
IMAGE_NAME_LATEST: "$CI_REGISTRY_IMAGE/coast-recipes:latest"
IMAGE_NAME_REMOTE: instituteforsoftware/coast-recipes
IMAGE_VENDOR: "IFS Institute For Software"
stages:
- build
- test
- deploy
default:
image: docker:latest
Build:
stage: build
tags:
- docker
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.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
--file=Dockerfile
.
- docker push $IMAGE_NAME_COMMIT_REF
Test:
stage: test
tags:
- docker
variables:
SERVICE_NAME: recipes_test_${CI_JOB_ID}
SERVICE_PORT_INTERN: 51200
before_script:
- ( cd /tmp && wget https://gitlab.dev.ifs.hsr.ch/ifs/wait-for-it/raw/master/wait-for-it.sh && chmod +x wait-for-it.sh )
script:
- docker run --detach --rm --name ${SERVICE_NAME} --hostname=${SERVICE_NAME} $IMAGE_NAME_COMMIT_REF
- service_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${SERVICE_NAME})
- /tmp/wait-for-it.sh --host=${service_ip} --port=${SERVICE_PORT_INTERN} --timeout=${WAIT_ON_SERVER_TIME:-30} --strict -- sh -c "wget --server-response --quiet -O /dev/null http://${service_ip}:${SERVICE_PORT_INTERN}";
after_script:
- docker logs --timestamps --details --tail=100 ${SERVICE_NAME} || true;
- docker container stop --time 1 ${SERVICE_NAME} || true
Tag:
stage: deploy
only:
- tags
tags:
- docker
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;
} || true
- test -n "$MICROBADGER_UPDATE_HOOK" && {
wget --post-data "" $MICROBADGER_UPDATE_HOOK;
} || true
Deploy latest image:
stage: deploy
only:
- tags
when: manual
tags:
- docker
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;
} || true
- test -n "$MICROBADGER_UPDATE_HOOK" && {
wget --post-data "" $MICROBADGER_UPDATE_HOOK;
} || true
- test -n "$TRIGGER_URL" && {
wget --post-data "token=$TRIGGER_TOKEN&ref=master" $TRIGGER_URL;
} || true
.project 0 → 100644
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>docker-coast-recipes</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
= Changelog
== tag: 0.9.0
* Bumped version to 0.9.0 (810e01d)
* based image on a multi compiler ubuntu image, added gitlab ci (c7d8d02)
* adjusted image vendor to IFS (431e518)
* added job id as suffix for service name (be32838)
* changed method to test locally started recipes server (7d4590a)
* do http level testing only (e0d3814)
* log containers and address (0244a65)
* don't use dind service (10e89a6)
* don't change build directory in before_script (a6826bd)
* removed local copies of wait-foor scripts (d663da1)
* use ash because bash is not available (3fd2775)
* scripts executable bit set (4141590)
* using wait-for-it to wait on recipes server (cebfffa)
* show log timestamps (8ced189)
* added missing semicolon (1a95cd3)
* added missing publish port arguments (a1b6988)
* increased timeout for test and added hostname (73b416c)
* stop running container also in case of errors (606bcab)
* added changelog (c99a666)
* reverted extensive debug logging (a056a3c)
* find out what's wrong with ci building (ca8b8e8)
* added sample docker-compose file to start recipes (56f4417)
* execute bash commands in non interactive mode (8463862)
* wait on recipes server to become available (03967fc)
* use recipes wait timeout from envvar if available (6b3d6be)
* extended test step to be more verbose (3f8cca7)
* gitlab ci build file added (c3459c5)
* DRY: use coast-build image as base (c817eb1)
* cloning coast repos fixed (cffb1be)
* added missing lib32-zlib (9674d85)
* removed certificate tweaks as we now have valid ssl certs (9bc14d1)
* replacing pip.conf placeholder with correct user name (399aecb)
* reflecting base image changes regarding removed UIG/GID variables (77cbe08)
* removed interactive option from bash commands (131521c)
* not checking signatures for ib fonts (9ff0548)
* not updating installed packages before installing new ones (e9dbe15)
* Initial setup for a Coast Recipes image (0b77cf5)
FROM marcelhuberfoo/arch
FROM instituteforsoftware/coast-build:latest
MAINTAINER Marcel Huber <marcelhuberfoo@gmail.com>
USER $USERNAME
USER root
RUN git clone --branch feature/FixCompilation https://gitlab.dev.ifs.hsr.ch/ifs/coast.git $SOURCEDIR/coast
WORKDIR $SOURCEDIR/coast
RUN git clone --branch master https://gerrit.coast-project.org/p/boost.git 3rdparty/boost
RUN git clone --branch master https://gerrit.coast-project.org/p/openssl.git 3rdparty/openssl
RUN git clone --branch master https://gitlab.dev.ifs.hsr.ch/ifs/wdscripts.git
RUN git clone --branch master https://gerrit.coast-project.org/p/recipes.git
RUN echo -e '[infinality-bundle]\nSigLevel=Never\nServer = http://bohoomil.com/repo/$arch\n[infinality-bundle-fonts]\nSigLevel=Never\nServer = http://bohoomil.com/repo/fonts' >> /etc/pacman.conf
RUN pacman -Syy && \
printf "\\ny\\ny\\n" | pacman -S multilib-devel && \
printf "y\\ny\\n" | pacman -Scc
RUN pacman -S --noconfirm --quiet --noprogressbar --needed python2 git lib32-openssl lib32-zlib gdb doxygen graphviz \
fontconfig-infinality-ultimate ibfonts-meta-base && \
printf "y\\ny\\n" | pacman -Scc
RUN rm -f /var/lib/pacman/sync/*.db
RUN bash -c "pip install --upgrade -r $SOURCEDIR/coast/requires.txt"
ADD entrypoint.sh /
ADD pip.conf /$UNAME/.pip/
RUN sed -i "s|USER|$UNAME|" /$UNAME/.pip/pip.conf
RUN chown -R $UNAME:$GNAME /$UNAME/
ENV SCONSFLAGS="--enable-Trace --baseoutdir=$BUILDOUTPUTDIR/coast-build/ --with-src-boost=3rdparty/boost --with-bin-openssl=3rdparty/openssl"
USER $UNAME
ENV VENVDIR=/$UNAME/.venv27scons
RUN echo "[[ -d \"\$VENVDIR\" ]] && . $VENVDIR/bin/activate" >> $HOME/.bashrc
RUN cd $HOME && git clone --single-branch --branch master --depth 1 https://github.com/pypa/virtualenv.git
RUN python2 $HOME/virtualenv/virtualenv.py $VENVDIR
RUN cd $HOME && git clone --single-branch --branch master --depth 1 https://gerrit.coast-project.org/p/coast.git
RUN cd $HOME/coast && \
git clone --single-branch --branch master --depth 1 https://gerrit.coast-project.org/p/boost.git 3rdparty/boost &&\
git clone --single-branch --branch master --depth 1 https://gerrit.coast-project.org/p/wdscripts.git && \
git clone --single-branch --branch master --depth 1 https://gerrit.coast-project.org/p/recipes.git
RUN bash -l -c 'pip install -U -r $HOME/coast/requires.txt'
RUN bash -l -c 'cd $HOME/coast && \
scons -u --jobs=$(nproc) --with-src-boost=3rdparty/boost --ignore-missing --doxygen-only && \
scons -u --jobs=$(nproc) CoastRecipes --with-src-boost=3rdparty/boost && \
cd apps/CoastRecipes && ln -s ../../doc/Coast/html COASTDoc'
USER root
RUN bash -c "scons -u --jobs=$(nproc) CoastRecipes"
RUN bash -c "scons -u --ignore-missing --doxygen-only && \
ln -sf $BUILDOUTPUTDIR/coast-build/doc/Coast/html $BUILDOUTPUTDIR/coast-build/apps/CoastRecipes/COASTDoc"
EXPOSE 51200 51201
ENTRYPOINT ["/entrypoint.sh"]
CMD ["dummy"]
CMD bash -c "scons -u --jobs=$(nproc) CoastRecipes --run-force"
0.9.0
\ No newline at end of file
groups:
default:
- recipes
containers:
recipes: &cref
build:
context: .
file: Dockerfile
image: marcelhuberfoo/docker-coast-recipes
run: &crefrun
detach: false
# env:
stop-signal: SIGINT
# volume:
publish:
- "51200:51200"
- "51201:51201"
interactive: true
tty: true
exec:
interactive: true
tty: true
cshell: { <<: *cref, run: { <<: *crefrun, detach, entrypoint: /bin/bash, tty: true, interactive: true } }
volumes:
#!/bin/sh
set -e
umask 002
if [ "$1" = 'dummy' ]; then
exec gosu $UNAME bash -l -c 'cd $HOME/coast && scons -u --jobs=$(nproc) CoastRecipes --with-src-boost=3rdparty/boost --run'
fi
exec "$@"
[global]
index-url=https://devpi.coast-project.org/coast/CoastSconsider/+simple
networks:
web:
attachable: true
driver: overlay
external: true
name: web
services:
recipes:
deploy:
labels:
traefik.docker.network: web
traefik.enable: "True"
traefik.nonssl.frontend.entrypoints: http
traefik.nonssl.frontend.headers.SSLRedirect: "False"
traefik.nonssl.frontend.redirect.entryPoint: http
traefik.nonssl.frontend.rule: Host:recipes.docker.localhost
traefik.nonssl.port: '51200'
traefik.nonssl.protocol: http
mode: replicated
replicas: 0
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 10
window: 300s
environment:
TZ: CET-1CEST,M3.5.0,M10.5.0/3
hostname: '{{.Service.Name}}'
image: instituteforsoftware/coast-recipes
networks:
web: null
ports:
- mode: host
protocol: tcp
published: 51200
target: 51200
- mode: host
protocol: tcp
published: 51201
target: 51201
stop_signal: SIGINT
version: '3.7'
#configs:
# wait-for-it:
# external: true
# name: wait-for-it.sh.v1.0.0
networks:
web:
attachable: true
driver: overlay
external: true
name: web
services:
recipes:
deploy:
labels:
traefik.docker.network: web
traefik.enable: "True"
traefik.nonssl.frontend.entrypoints: http
traefik.nonssl.frontend.headers.SSLRedirect: false
traefik.nonssl.frontend.redirect.entryPoint: http
traefik.nonssl.frontend.rule: Host:$RECIPES_FQDN
traefik.nonssl.port: $RECIPES_PORT
traefik.nonssl.protocol: http
# traefik.ssl.frontend.entrypoints: http
# traefik.ssl.frontend.headers.SSLRedirect: false
# traefik.ssl.frontend.redirect.entryPoint: http
# traefik.ssl.frontend.rule: Host:$RECIPES_FQDN
# traefik.ssl.port: $RECIPES_PORT_SSL
# traefik.ssl.protocol: http
mode: replicated
replicas: 0
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 10
window: 300s
environment:
# https://github.com/jwilder/nginx-proxy#how-ssl-support-works
# HTTPS_METHOD: nohttps
TZ: $TZ
hostname: '{{.Service.Name}}'
image: instituteforsoftware/coast-recipes
networks:
web: null
# not needed in case we're behind traefik
ports:
- mode: host
protocol: tcp
published: 51200
target: 51200
- mode: host
protocol: tcp
published: 51201
target: 51201
stop_signal: SIGINT
version: '3.7'
#volumes:
# service-vol: {}
RECIPES_FQDN=recipes.$DOMAINNAME
RECIPES_PORT=51200
RECIPES_PORT_SSL=51201
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment