Add code for local docker image build and testing
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 28 Sep 2022 07:14:58 +0000 (09:14 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 28 Sep 2022 07:14:58 +0000 (09:14 +0200)
And vscode, git setup

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
.editorconfig [new file with mode: 0644]
.gitignore
.vscode/extensions.json [new file with mode: 0644]
.vscode/settings.json [new file with mode: 0644]
.xmakecfg
Makefile [new file with mode: 0644]
README.md
docker-compose.yml [new file with mode: 0644]

diff --git a/.editorconfig b/.editorconfig
new file mode 100644 (file)
index 0000000..e68e80a
--- /dev/null
@@ -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
index 337a35387f7176c0f40af7ec23bb9d8de586e316..2929587554654096e93ba29987f64783ccead16a 100644 (file)
@@ -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 (file)
index 0000000..36518c3
--- /dev/null
@@ -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 (file)
index 0000000..eb3d18b
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "editor.codeActionsOnSave": {
+    "source.fixAll": true
+  }
+}
index 83e11f8c28ff93f8121aa3d619b12c4c9ad4e0d0..9cb334bcb9ae036fc86f364dfe9fba5c3b5a6be6 100644 (file)
--- 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 (file)
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
index 3a493f6775d4cbe5d4b573eec15e8aba48e68eeb..a7b819729b2e64f66ee55cacb91725ad3e1f9a58 100644 (file)
--- 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 (file)
index 0000000..12dabbf
--- /dev/null
@@ -0,0 +1,5 @@
+version: '3.7'
+services:
+  ci-build:
+    build:
+      dockerfile: Dockerfile