From: Jérôme Benoit Date: Wed, 28 Sep 2022 07:14:58 +0000 (+0200) Subject: Add code for local docker image build and testing X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=482fe6a2e2abae083ff60edafea1ad15bea3e368;p=mbt-docker.git Add code for local docker image build and testing And vscode, git setup Signed-off-by: Jérôme Benoit --- diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e68e80a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +end_of_line = lf +max_line_length = 100 + +[*.md] +max_line_length = off +trim_trailing_whitespace = false + +[{Makefile,**.mk}] +# Use tabs for indentation (Makefiles require tabs) +indent_style = tab diff --git a/.gitignore b/.gitignore index 337a353..2929587 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,136 @@ -# Mac OS temp files -**/.DS_Store \ No newline at end of file +# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,vim,git,linux,windows,macos +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,vim,git,linux,windows,macos + +### Git ### +# Created by git for backups. To disable backups in Git: +# $ git config --global mergetool.keepBackup false +*.orig + +# Created by git when using merge tools for conflicts +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* +*_BACKUP_*.txt +*_BASE_*.txt +*_LOCAL_*.txt +*_REMOTE_*.txt + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### VisualStudioCode ### +.vscode/* +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# Support for Project snippet scope +.vscode/*.code-snippets + +# Ignore code-workspaces +*.code-workspace + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,vim,git,linux,windows,macos diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..36518c3 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "eamodio.gitlens", + "EditorConfig.EditorConfig", + "ms-azuretools.vscode-docker", + "streetsidesoftware.code-spell-checker" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..eb3d18b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "editor.codeActionsOnSave": { + "source.fixAll": true + } +} diff --git a/.xmakecfg b/.xmakecfg index 83e11f8..9cb334b 100644 --- a/.xmakecfg +++ b/.xmakecfg @@ -8,4 +8,4 @@ version=1.0.0 name=dockerbuild bundle=true aid=mbt-docker -gid=com.sap.emobility \ No newline at end of file +gid=com.sap.emobility diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bbf6910 --- /dev/null +++ b/Makefile @@ -0,0 +1,52 @@ +PROJECT_NAME?=sap-e-mobility +NAME:=ci-build +SUBMODULES_INIT?=false +DOCKER_REGISTRY_USERNAME?=fraggle0 +DOCKER_REGISTRY_PASSWORD?= +DOCKER_REGISTRY_NAME?=$(NAME) +DOCKER_REGISTRY_TAG?=latest + +.PHONY: all + +default: all + +submodule-update: + git submodule update --init --recursive + +submodules-init= +ifeq '$(SUBMODULES_INIT)' 'true' + submodules-init += submodule-update +endif + +$(NAME): $(submodules-init) + docker-compose -p $(PROJECT_NAME) up -d + +$(NAME)-force: $(submodules-init) + docker-compose -p $(PROJECT_NAME) up -d --build --force-recreate + +all: $(NAME) + +clean-images: + -docker rmi $(PROJECT_NAME)-$(NAME) + +clean-containers: + -docker-compose -p $(PROJECT_NAME) down + +clean: clean-containers clean-images + +docker-tag-registry: + docker tag $(PROJECT_NAME)-$(NAME) $(DOCKER_REGISTRY_USERNAME)/$(DOCKER_REGISTRY_NAME):$(DOCKER_REGISTRY_TAG) + +docker-login-registry: + -docker login -u '$(DOCKER_REGISTRY_USERNAME)' -p '$(DOCKER_REGISTRY_PASSWORD)' + +docker-push-registry: $(NAME)-force docker-tag-registry + docker push $(DOCKER_REGISTRY_USERNAME)/$(DOCKER_REGISTRY_NAME):$(DOCKER_REGISTRY_TAG) + +dist-clean-images: + docker image prune -a -f + +dist-clean-volumes: + docker volume prune -f + +dist-clean: clean-containers dist-clean-volumes dist-clean-images diff --git a/README.md b/README.md index 3a493f6..a7b8197 100644 --- a/README.md +++ b/README.md @@ -22,4 +22,4 @@ Register Project Portal - Change _BUILD_DEPLOY_ to `build_and_deploy` - Click _Build_ -[Kudos - Richards images](https://github.wdf.sap.corp/D057156) \ No newline at end of file +[Kudos - Richards images](https://github.wdf.sap.corp/D057156) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..12dabbf --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +version: '3.7' +services: + ci-build: + build: + dockerfile: Dockerfile