Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
IQB
PersonalDB
Commits
c6096148
Commit
c6096148
authored
Mar 16, 2022
by
svwolter
Browse files
Add GitLab CI/CD configuration file
parent
2b117ed7
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
0 → 100644
View file @
c6096148
image
:
node:lts-alpine
stages
:
-
setup
-
build
-
test
-
packetize
-
deploy
install-dependencies
:
stage
:
setup
interruptible
:
true
only
:
-
main
-
merge_requests
cache
:
key
:
files
:
-
package-lock.json
paths
:
-
node_modules
-
.npm/
script
:
-
npm ci --cache .npm
artifacts
:
paths
:
-
node_modules
.distributed
:
interruptible
:
true
only
:
-
main
-
merge_requests
needs
:
-
install-dependencies
artifacts
:
paths
:
-
node_modules/.cache/nx
build-app
:
stage
:
build
extends
:
.distributed
script
:
-
apk update && apk add git
-
npx nx affected --base=HEAD~1 --target=build --parallel=3
artifacts
:
paths
:
-
dist
test-app
:
stage
:
test
extends
:
.distributed
script
:
-
apk update && apk add git
-
npx nx affected --base=HEAD~1 --target=test --parallel=2
build-docker-image
:
stage
:
packetize
extends
:
.distributed
needs
:
-
install-dependencies
-
build-app
-
test-app
image
:
docker:git
variables
:
DOCKER_TLS_CERTDIR
:
"
"
REGISTRY
:
$CI_REGISTRY
REGISTRY_USER
:
$CI_REGISTRY_USER
REGISTRY_PASSWORD
:
$CI_REGISTRY_PASSWORD
REGISTRY_PROJECT
:
"
/${CI_PROJECT_PATH}/"
services
:
-
docker:dind
before_script
:
-
apk update && apk add npm
-
npm i -g npx
-
export TAG=$(git rev-parse --short HEAD)
-
echo "$REGISTRY_PASSWORD" | docker login -u $REGISTRY_USER --password-stdin $REGISTRY
script
:
-
npx nx affected --base=HEAD~1 --target=docker-build --registry=$REGISTRY --registryProject=$REGISTRY_PROJECT --tag=$TAG --parallel=2
after_script
:
-
docker logout $REGISTRY
angular.json
View file @
c6096148
...
...
@@ -50,6 +50,20 @@
"jestConfig"
:
"apps/api/jest.config.js"
,
"passWithNoTests"
:
true
}
},
"docker-build"
:
{
"builder"
:
"@nrwl/workspace:run-commands"
,
"options"
:
{
"commands"
:
[
{
"command"
:
"docker login {args.registry}"
,
"forwardAllArgs"
:
false
},
"docker build -f apps/api/Dockerfile --build-arg project=api -t {args.registry}{args.registryProject}iqbberlin/personaldb-backend:{args.tag} ."
,
"docker push {args.registry}{args.registryProject}iqbberlin/personaldb-backend:{args.tag}"
],
"parallel"
:
false
}
}
}
},
...
...
@@ -173,6 +187,20 @@
"jestConfig"
:
"apps/frontend/jest.config.js"
,
"passWithNoTests"
:
true
}
},
"docker-build"
:
{
"builder"
:
"@nrwl/workspace:run-commands"
,
"options"
:
{
"commands"
:
[
{
"command"
:
"docker login {args.registry}"
,
"forwardAllArgs"
:
false
},
"docker build -f apps/frontend/Dockerfile --build-arg project=frontend -t {args.registry}{args.registryProject}iqbberlin/personaldb-frontend:{args.tag} ."
,
"docker push {args.registry}{args.registryProject}iqbberlin/personaldb-frontend:{args.tag}"
],
"parallel"
:
false
}
}
},
"tags"
:
[]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment