CI 测试
This commit is contained in:
parent
ad4811f8a1
commit
4e694d278a
40
.gitlab-ci.yml
Normal file
40
.gitlab-ci.yml
Normal file
@ -0,0 +1,40 @@
|
||||
docker-build:
|
||||
image: docker:latest
|
||||
stage: build
|
||||
tags:
|
||||
- vm
|
||||
before_script:
|
||||
- docker login "$DOCKER_REGISTRY" -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
|
||||
script:
|
||||
- |
|
||||
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
||||
tag=""
|
||||
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
|
||||
else
|
||||
tag=":$CI_COMMIT_REF_SLUG"
|
||||
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
|
||||
fi
|
||||
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
|
||||
- docker push "$CI_REGISTRY_IMAGE${tag}"
|
||||
# Run this job in a branch where a Dockerfile exists
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH
|
||||
exists:
|
||||
- Dockerfile
|
||||
kubectl:
|
||||
image: bitnami/kubectl
|
||||
stage: build
|
||||
tags:
|
||||
- k8s
|
||||
before_script:
|
||||
- kubectl get pods -n foo
|
||||
script:
|
||||
- |
|
||||
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
||||
tag=""
|
||||
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
|
||||
else
|
||||
tag=":$CI_COMMIT_REF_SLUG"
|
||||
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
|
||||
fi
|
||||
- echo test
|
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM node:20
|
||||
LABEL authors="ivamp"
|
||||
|
||||
WORKDIR /app
|
||||
ADD . /app
|
||||
|
||||
RUN npm config set registry https://registry.npm.taobao.org/ && yarn config set registry https://registry.npm.taobao.org/
|
||||
|
||||
RUN npm install -g -s --no-progress yarn && \
|
||||
yarn && \
|
||||
yarn cache clean \
|
||||
|
||||
CMD [ "yarn", "migrate" ]
|
||||
|
||||
CMD [ "yarn", "start" ]
|
||||
|
||||
EXPOSE 8080
|
@ -10,19 +10,21 @@
|
||||
"mysql2": "^3.6.2",
|
||||
"path": "^0.12.7",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"typeorm": "0.3.17"
|
||||
"typeorm": "0.3.17",
|
||||
"ts-node": "^10.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.20",
|
||||
"@types/morgan": "^1.9.7",
|
||||
"@types/node": "^16.11.10",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "4.5.2"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "ts-node main.ts",
|
||||
"typeorm": "typeorm-ts-node-commonjs",
|
||||
"migrate": "typeorm-ts-node-commonjs migration:run -d src/config/typeorm.ts",
|
||||
"migrate:rollback": "typeorm-ts-node-commonjs migration:revert -d src/config/typeorm.ts"
|
||||
"migrate:rollback": "typeorm-ts-node-commonjs migration:revert -d src/config/typeorm.ts",
|
||||
"make:migration": "typeorm-ts-node-commonjs migration:create",
|
||||
"migrate:fresh": "typeorm-ts-node-commonjs schema:drop -d src/config/typeorm.ts"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user