Merge remote-tracking branch 'origin/master'

This commit is contained in:
Marco Zeisler 2021-05-11 20:03:45 +02:00
commit 3ec3516865
6 changed files with 106 additions and 50 deletions

View File

@ -1,20 +1,18 @@
variables:
DOCKER_USER: pfingstfrosch
ASSIGNMENT: waecm-2021-group-04-bsp-3
stages:
- build
- lint
- test
- compose-build
- compose-push
- docker-build
- docker-push
.lint:
stage: lint
.build:
stage: build
.test:
stage: test
.compose-build:
stage: compose-build
.compose-push:
stage: compose-push
.python-image:
image: python:3.8-slim
.angular-image:
image: johnpapa/angular-cli
########
# BUILD
@ -26,9 +24,10 @@ stages:
# - echo ''
# extends:
# - .build
.build:
stage: build
build_be:
image: python:3.8-slim
before_script:
- apt-get update
- apt-get install -y build-essential gcc
@ -41,19 +40,24 @@ build_be:
untracked: true
extends:
- .build
- .python-image
########
# LINT
#################################################################
.lint:
stage: lint
lint_fe:
image: johnpapa/angular-cli
script:
- cd ./frontend
- npm update
- npm run -- ng lint
- ng lint
extends:
- .lint
- .angular-image
artifacts:
untracked: true
# needs:
# - build_fe
@ -68,45 +72,88 @@ lint_fe:
########
# TEST
#################################################################
.test:
stage: test
test_fe:
script:
- echo ''
- cd ./frontend
- npm update
- ng test
extends:
- .test
- .angular-image
needs:
- lint_fe
test_be:
#test_be:
# script:
# - cd ./backend
# - ls -l
# extends:
# - .test
# needs:
# - build_be
########
# DOCKER-BUILD
#################################################################
.docker-build:
stage: docker-build
.docker-setup:
image: docker:latest
services:
- docker:dind
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PW
artifacts:
untracked: true
tags:
- docker
docker-build-fe:
script:
- cd ./backend
- ls -l
- docker-compose build waecm_g4_fe
- docker save -o waecm_g4_fe ${DOCKER_USER}/${ASSIGNMENT}-fe
extends:
- .test
- .docker-build
- .docker-setup
needs:
- test_fe
docker-build-be:
script:
- docker-compose build waecm_g4_be
- docker save -o waecm_g4_be ${DOCKER_USER}/${ASSIGNMENT}-be
extends:
- .docker-build
- .docker-setup
needs:
- build_be
########
# COMPOSE-BUILD
# DOCKER-PUSH
#################################################################
.docker-push:
stage: docker-push
compose-build:
docker-push-fe:
script:
- echo ''
- docker image load --input waecm_g4_fe
- docker-compose push waecm_g4_fe
extends:
- .compose-build
- .docker-push
- .docker-setup
needs:
- test_be
- test_fe
- docker-build-fe
########
# COMPOSE-PUSH
#################################################################
compose-push:
docker-push-be:
script:
- echo ''
- docker image load --input waecm_g4_be
- docker-compose push waecm_g4_be
extends:
- .compose-push
- .docker-push
- .docker-setup
needs:
- compose-build
- docker-build-be

View File

@ -42,3 +42,7 @@ The docker images are available at:
* sha256 digest: 2d6526c871285f81dee714f41c41750e6e9c4e124cdc78f69ecd17036f620399
* [waecm-2021-group-04-bsp2-be](https://hub.docker.com/r/pfingstfrosch/waecm-2021-group-04-bsp-2-be)
* sha256 digest: fe0b490a7ad5546371a8a709c9e4f80985326c9a27dddfeef6179f89affc9105
## CI
Look at git-lab project https://gitlab.com/Pfingstfrosch/waecm-g4-CI for CI execution.
This repository is mirrored to the CI repo, where the pipeline is executed.

1
backend/.gitignore vendored
View File

@ -7,3 +7,4 @@ media/feed-icons
*.sqlite3
waecm-2021-group-04.egg-info
app_be/migrations
/dist

View File

@ -2,20 +2,24 @@ FROM python:3.8-slim
ENV PYTHONUNBUFFERED 1
ENV PATH="/opt/venv/bin:$PATH"
RUN apt-get update; \
apt-get install -y build-essential gcc; \
python -m venv /opt/venv; \
python -m pip install --upgrade pip; \
mkdir /code;
WORKDIR /code
COPY setup.py /code/
COPY requirements.txt /code/
RUN pip install -r requirements.txt
# will be build in a different stage in CI
#RUN apt-get update; \
# apt-get install -y build-essential gcc; \
# python -m venv /opt/venv; \
# python -m pip install --upgrade pip; \
# mkdir /code;
#
#WORKDIR /code
#
#COPY setup.py /code/
#COPY requirements.txt /code/
#
#RUN pip install -r requirements.txt
# install and use built artifact
COPY . /code/
WORKDIR /code
RUN pip install ./dist/waecm*
RUN chmod 777 scripts/entrypoint.sh
ENTRYPOINT ["scripts/entrypoint.sh"]
RUN chmod 777 ./scripts/entrypoint.sh
ENTRYPOINT ["./scripts/entrypoint.sh"]

View File

@ -5,7 +5,7 @@ from setuptools import find_packages, setup
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(name='waecm-2021-group-04',
version='0.0.0',
version='3',
packages=find_packages(),
include_package_data=True,
install_requires=[

View File

@ -1,6 +1,6 @@
# Stage 1
FROM node:alpine
FROM johnpapa/angular-cli
WORKDIR /app