Compare commits
14 Commits
feature/xa
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| b859a55d35 | |||
| 379155e012 | |||
| 95c277d7df | |||
| bcc46710cb | |||
| 7bc625c53f | |||
| 5ce61d2f9c | |||
| f46dc83e52 | |||
| 5123d5302e | |||
| 218a07a700 | |||
| 1ccb39ad60 | |||
| 906854af37 | |||
|
|
22d8179a13 | ||
|
|
720656bdfb | ||
|
|
64ff444d86 |
@@ -1,33 +0,0 @@
|
|||||||
version: 2
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
docker:
|
|
||||||
- image: cypress/base:8
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- restore_cache: # special step to restore the dependency cache
|
|
||||||
key: dependency-cache-{{ checksum "package.json" }}
|
|
||||||
- run:
|
|
||||||
name: install-npm-wee
|
|
||||||
command: npm install
|
|
||||||
- save_cache: # special step to save the dependency cache
|
|
||||||
key: dependency-cache-{{ checksum "package.json" }}
|
|
||||||
paths:
|
|
||||||
- ./node_modules
|
|
||||||
- run:
|
|
||||||
name: clone-e2e-test
|
|
||||||
command: git clone https://github.com/contentful/the-example-app-e2e-tests.git ./test/e2e
|
|
||||||
- run:
|
|
||||||
name: install-e2e-test
|
|
||||||
command: cd ./test/e2e && npm install
|
|
||||||
- run:
|
|
||||||
name: test
|
|
||||||
command: npm run test
|
|
||||||
- store_artifacts:
|
|
||||||
path: /tmp/artifact-1
|
|
||||||
|
|
||||||
destination: artifact-file-cypress-result_`date +%Y-%m-%d_%H-%M-%S`
|
|
||||||
|
|
||||||
- store_artifacts:
|
|
||||||
path: /tmp/artifacts
|
|
||||||
|
|
||||||
38
DockerJenkinsfile
Normal file
38
DockerJenkinsfile
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
node {
|
||||||
|
label 'docker' //Agent needs to have Docker Engine installed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Docker Stop') {
|
||||||
|
steps {
|
||||||
|
// Stop Docker if running
|
||||||
|
sh 'docker stop the-example-app | true' //Not important, just logistics
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Docker RM') {
|
||||||
|
steps {
|
||||||
|
// Rm Docker image to build a new one from scratch
|
||||||
|
sh 'docker rm the-example-app | true' //Not important, just logistics
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
// Get some code from a GIT repository
|
||||||
|
git 'https://git.agile611.com/Agile611/the-example-app-nodejs.git'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Docker Build') {
|
||||||
|
steps {
|
||||||
|
sh 'docker build -t the-example-app.nodejs .'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Docker Run') {
|
||||||
|
steps {
|
||||||
|
// Run Docker image on port 3000
|
||||||
|
sh 'docker run -p 3000:3000 --name the-example-app -d the-example-app.nodejs'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
55
DockerPipelinePluginJenkinsfile
Normal file
55
DockerPipelinePluginJenkinsfile
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
// You need a valid credentials for Docker Hub
|
||||||
|
// You need https://plugins.jenkins.io/docker-workflow/ on your jenkins instance
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
node {
|
||||||
|
label 'docker' //Agent needs to have Docker Engine installed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
environment {
|
||||||
|
// Executem una comanda shell per obtenir la data actual i la guardem com a variable
|
||||||
|
DATA = sh(returnStdout: true, script: 'date +%Y.%m.%d').trim()
|
||||||
|
DOCKER_HUB_USER='guillemhs'
|
||||||
|
IMAGE_NAME="${DOCKER_HUB_USER}/the-example-app-nodejs"
|
||||||
|
REGISTRY_CRED_ID='docker-credentials'
|
||||||
|
TAG="${DATA}.${env.BUILD_NUMBER}"
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
// Get some code from the sane repository
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Docker Build') {
|
||||||
|
steps {
|
||||||
|
script{
|
||||||
|
echo "Build image ..."
|
||||||
|
docker.build("${IMAGE_NAME}:${TAG}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Docker Push')
|
||||||
|
{
|
||||||
|
steps{
|
||||||
|
script{
|
||||||
|
docker.withRegistry('',REGISTRY_CRED_ID){
|
||||||
|
def app = docker.image("${IMAGE_NAME}:${TAG}")
|
||||||
|
|
||||||
|
echo "Pushing image to Docker Hub ..."
|
||||||
|
app.push("${TAG}")
|
||||||
|
app.push("latest")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post{
|
||||||
|
always{
|
||||||
|
cleanWs()
|
||||||
|
sh "docker rmi ${IMAGE_NAME}:${TAG} || true"
|
||||||
|
sh "docker rmi ${IMAGE_NAME}:latest || true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
33
Jenkinsfile
vendored
Normal file
33
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
node {
|
||||||
|
label 'agent1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tools {
|
||||||
|
// Install the NodeJS version configured as "nodejs8170" and add it to the path.
|
||||||
|
nodejs "nodejs8170"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
// Get some code from a GitHub repository
|
||||||
|
git 'https://git.agile611.com/Agile611/the-example-app-nodejs.git'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Install') {
|
||||||
|
steps {
|
||||||
|
// Install NPM Dependencies
|
||||||
|
sh 'npm install'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Run') {
|
||||||
|
steps {
|
||||||
|
// Run server on port 3000
|
||||||
|
sh 'npm run start:dev'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,6 @@ Without any changes, this app is connected to a Contentful space with read-only
|
|||||||
Clone the repo and install the dependencies.
|
Clone the repo and install the dependencies.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/contentful/the-example-app.nodejs.git
|
|
||||||
cd the-example-app.nodejs
|
cd the-example-app.nodejs
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ You can also run this app as a Docker container:
|
|||||||
Step 1: Clone the repo
|
Step 1: Clone the repo
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/contentful/the-example-app.nodejs.git
|
git clone https://git.agile611.com/Agile611/the-example-app-nodejs.git
|
||||||
```
|
```
|
||||||
|
|
||||||
Step 2: Build the Docker image
|
Step 2: Build the Docker image
|
||||||
@@ -80,3 +79,8 @@ Step 4: Push your image to the Docker hub
|
|||||||
docker push yourhubusername/verse_gapminder:firsttry
|
docker push yourhubusername/verse_gapminder:firsttry
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This repository is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0).
|
||||||
|
For details, see https://creativecommons.org/licenses/by-sa/4.0/.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
NODE_ENV=development
|
NODE_ENV=master
|
||||||
CONTENTFUL_SPACE_ID=qz0n5cdakyl9
|
CONTENTFUL_SPACE_ID=9a9saj5xvssa
|
||||||
CONTENTFUL_DELIVERY_TOKEN=580d5944194846b690dd89b630a1cb98a0eef6a19b860ef71efc37ee8076ddb8
|
CONTENTFUL_DELIVERY_TOKEN=dhq4W2V2OXCCiwe2ez8KPvRTlRYlMnHwlnlJ27AGBZ4
|
||||||
CONTENTFUL_PREVIEW_TOKEN=e8fc39d9661c7468d0285a7ff949f7a23539dd2e686fcb7bd84dc01b392d698b
|
CONTENTFUL_PREVIEW_TOKEN=CIaIDWM0DsSLeiOYSFfYVxILef5IiVgtSTjTrBu4tJg
|
||||||
CONTENTFUL_DELIVERY_API_HOST=cdn.contentful.com
|
CONTENTFUL_DELIVERY_API_HOST=cdn.contentful.com
|
||||||
CONTENTFUL_PREVIEW_API_HOST=preview.contentful.com
|
CONTENTFUL_PREVIEW_API_HOST=preview.contentful.com
|
||||||
PORT=3000
|
PORT=3000
|
||||||
|
|||||||
Reference in New Issue
Block a user