-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from choxx/jenkins_setup
Jenkins support
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ redisinsight | |
broker | ||
.env | ||
migrations/ | ||
dist/ | ||
dist/ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM node:16 AS builder | ||
|
||
# Create app directory | ||
WORKDIR /app | ||
|
||
#RUN cp .env .env | ||
RUN mkdir -p broker | ||
RUN mkdir -p redisinsight | ||
RUN chown -R 1001:1001 broker | ||
RUN chown -R 1001:1001 redisinsight | ||
|
||
COPY package.json ./ | ||
COPY yarn.lock ./ | ||
|
||
# Install app dependencies | ||
RUN yarn install | ||
|
||
COPY . . | ||
|
||
# Generate build | ||
RUN yarn run build | ||
|
||
CMD [ "npx", "nx", "serve", "api" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
node() { | ||
properties([ | ||
parameters([ | ||
string(name: 'docker_repo', defaultValue: 'yaus-web', description: 'Docker Image Name'), | ||
string(name: 'docker_server', defaultValue: 'localhost:5000', description: 'Docker Registry URL'), | ||
|
||
]) | ||
]) | ||
stage('Checkout') { | ||
cleanWs() | ||
checkout scm | ||
commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim() | ||
env.commit_id = sh(script: 'echo ' + env.docker_repo + '_' + commit_hash + '_' + env.BRANCH_NAME, returnStdout: true).trim() | ||
echo "${env.commit_id}" | ||
} | ||
|
||
stage('docker-build') { | ||
sh ''' | ||
# docker build -f <location-of-docker-file> -t <tag-of-docker-image> <context-for-docker-image> | ||
docker build -f ./Dockerfile -t $docker_server/$docker_repo:$commit_id . | ||
''' | ||
} | ||
|
||
stage('docker-push') { | ||
sh ''' | ||
docker push $docker_server/$docker_repo:$commit_id | ||
''' | ||
} | ||
stage('ArchiveArtifacts') { | ||
sh("echo ${commit_id} > commit_id.txt") | ||
archiveArtifacts 'commit_id.txt' | ||
currentBuild.description = "${commit_id}" | ||
} | ||
} |