Skip to content

Commit

Permalink
Merge pull request #51 from eea/develop
Browse files Browse the repository at this point in the history
fix docker file and image build
  • Loading branch information
razvanMiu committed Dec 23, 2022
2 parents 8634972 + a67a50f commit 5056f5f
Show file tree
Hide file tree
Showing 18 changed files with 1,139 additions and 548 deletions.
85 changes: 83 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,96 @@ npm-debug.log*
.DS_Store

coverage

# Node
node_modules
coverage
jsdoc
webpack-assets.json
webpack-stats.json
npm-debug.log
dist
junit.xml
eslint.xml
yarn-error.log
build

# Other
.DS_Store
.idea
lighthouse-report.html
.vscode/
backend
.#*
*~

# Python
/api/.installed.cfg
/api/.mr.developer.cfg
/api/bin/
/api/develop-eggs/
/api/eggs/
/api/include/
/api/lib/
/api/lib64/
/api/notebook/env/
/api/parts/
/api/share/python-wheels/
/api/src/
/api/var/
/api/venv/
/bin/
/lib/
.Python
include
pip-selfcheck.json
pyvenv.cfg
share

# locales
locales/*.json

# Tests
/tests/bin
/tests/develop-eggs
/tests/parts
/tests/.installed.cfg
*.pyc
geckodriver.log
log.html
output.xml
report.html
selenium-screenshot-*.png
/selenium/
cypress/videos/
cypress/screenshots

# Local environment setup
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# generic
data
omelette

*.old
*~
src/addons
src/develop
src/develop
npm-cache
backend

# build
public/critical.css
/cache

# yarn 3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
18 changes: 15 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [3.20.0](https://github.com/eea/industry-frontend/compare/3.19.0...3.20.0) - 22 December 2022
### [3.21.0](https://github.com/eea/industry-frontend/compare/3.20.0...3.21.0) - 23 December 2022

#### :house: Internal changes

#### :rocket: New Features
- chore: add non-interactive flag in build command [valentinab25 - [`a42da1d`](https://github.com/eea/industry-frontend/commit/a42da1db439ea82fe8005ce7120ae62951890da1)]

- feat: use latest volto [Miu Razvan - [`2e33bcb`](https://github.com/eea/industry-frontend/commit/2e33bcbaf89b22e5a49913abc9d9f739c0a5d614)]
#### :hammer_and_wrench: Others

- Don't run cypress [Miu Razvan - [`5e8461a`](https://github.com/eea/industry-frontend/commit/5e8461a0f9610982b64e543bf974c5b6a8e7a6d3)]
- Use volto 16.0.0-alpha.45 for cypress tests [Miu Razvan - [`9ba418d`](https://github.com/eea/industry-frontend/commit/9ba418dacd5454840b4607db16e5689b94f18e77)]
- set volto kitkat version to 8.2.4 [Claudia Ifrim - [`e7018fe`](https://github.com/eea/industry-frontend/commit/e7018fe3c776855c1edb993ff9658b87ae8af11d)]
- update npm install command [Claudia Ifrim - [`637ba7d`](https://github.com/eea/industry-frontend/commit/637ba7d89268ffabac4f1704383b40074ca839e0)]
- add Makefile and update scripts [Nilesh - [`baf6eac`](https://github.com/eea/industry-frontend/commit/baf6eac49ec4f42e2b1b684711d1f55587ab962b)]
- update dockerfile [Nilesh - [`dc58cfd`](https://github.com/eea/industry-frontend/commit/dc58cfddd6c63042553402a05abff123e9dd90b4)]
- update docker file [Claudia Ifrim - [`8238d0b`](https://github.com/eea/industry-frontend/commit/8238d0baab8e2072b3ceaef14cce69a0f3e79fa0)]
- test: add tests from volto-industry-theme [valentinab25 - [`0ffe999`](https://github.com/eea/industry-frontend/commit/0ffe99975030c663d8b0aa112b442b12d51c60ca)]
### [3.20.0](https://github.com/eea/industry-frontend/compare/3.19.0...3.20.0) - 22 December 2022

#### :rocket: Dependency updates

Expand Down
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,33 @@ COPY . /opt/frontend/
WORKDIR /opt/frontend/

# Update apt packages
RUN runDeps="openssl ca-certificates patch git" \
RUN runDeps="openssl ca-certificates patch gosu git make tmux locales-all" \
&& apt-get update \
&& apt-get install -y --no-install-recommends $runDeps \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& chown -R node /opt/frontend/ \
&& npm install --location=global mrs-developer \
&& cp jsconfig.json.prod jsconfig.json \
&& mkdir -p /opt/frontend/src/addons \
&& rm -rf /opt/frontend/src/addons/* \
&& npm install -g mrs-developer
&& find /opt/frontend/ -not -user node -exec chown node {} \+ \
&& corepack enable

USER node

ARG MAX_OLD_SPACE_SIZE=8192
ENV NODE_OPTIONS=--max_old_space_size=$MAX_OLD_SPACE_SIZE
WORKDIR /opt/frontend/

RUN cd /opt/frontend \
&& RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn \
&& RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn build \
&& rm -rf /home/node/.cache
&& rm -rf /home/node/.cache \
&& rm -rf /home/node/.yarn \
&& rm -rf /home/node/.npm \
&& rm -rf /app/.yarn/cache

USER root

EXPOSE 3000 3001 4000 4001

ENTRYPOINT ["/opt/frontend/entrypoint-prod.sh"]
CMD ["yarn", "start:prod"]
USER root
165 changes: 83 additions & 82 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,76 +8,77 @@ pipeline {
dockerImage = ''
tagName = ''
SONARQUBE_TAG = 'industry.eea.europa.eu'
VOLTO = "16.0.0-alpha.45"
}

agent any

stages {

// stage('Integration tests') {
// parallel {
// stage('Integration with Cypress') {
// when {
// environment name: 'CHANGE_ID', value: ''
// }
// steps {
// node(label: 'docker') {
// script {
// try {
// sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
// sh '''docker pull eeacms/volto-project-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/volto-project-ci cypress'''
// } finally {
// try {
// sh '''rm -rf cypress-reports cypress-results'''
// sh '''mkdir -p cypress-reports cypress-results'''
// sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/cypress/videos cypress-reports/'''
// sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/cypress/reports cypress-results/'''
// archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true
// }
// finally {
// catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
// junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
// }
// sh script: "docker stop $BUILD_TAG-plone", returnStatus: true
// sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true
// sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true
// }
// }
// }
// }
// }
// }

// stage("Docker test build") {
// when {
// not {
// environment name: 'CHANGE_ID', value: ''
// }
// not {
// buildingTag()
// }
// environment name: 'CHANGE_TARGET', value: 'master'
// }
// environment {
// IMAGE_NAME = BUILD_TAG.toLowerCase()
// }
// steps {
// node(label: 'docker-host') {
// script {
// checkout scm
// try {
// dockerImage = docker.build("${IMAGE_NAME}", "--no-cache .")
// } finally {
// sh script: "docker rmi ${IMAGE_NAME}", returnStatus: true
// }
// }
// }
// }
// }


// }
// }
stage('Integration tests') {
parallel {
// stage('Integration with Cypress') {
// when {
// environment name: 'CHANGE_ID', value: ''
// }
// steps {
// node(label: 'docker') {
// script {
// try {
// sh '''docker pull eeacms/plone-backend; docker run --rm -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend'''
// sh '''docker pull eeacms/volto-project-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO eeacms/volto-project-ci cypress'''
// } finally {
// try {
// sh '''rm -rf cypress-reports cypress-results'''
// sh '''mkdir -p cypress-reports cypress-results'''
// sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/cypress/videos cypress-reports/'''
// sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/cypress/reports cypress-results/'''
// archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true
// }
// finally {
// catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
// junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
// }
// sh script: "docker stop $BUILD_TAG-plone", returnStatus: true
// sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true
// sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true
// }
// }
// }
// }
// }
// }

stage("Docker test build") {
when {
not {
environment name: 'CHANGE_ID', value: ''
}
not {
buildingTag()
}
environment name: 'CHANGE_TARGET', value: 'master'
}
environment {
IMAGE_NAME = BUILD_TAG.toLowerCase()
}
steps {
node(label: 'docker-host') {
script {
checkout scm
try {
dockerImage = docker.build("${IMAGE_NAME}", "--no-cache .")
} finally {
sh script: "docker rmi ${IMAGE_NAME}", returnStatus: true
}
}
}
}
}


}
}


stage('Pull Request') {
Expand Down Expand Up @@ -174,24 +175,24 @@ pipeline {
}
}

// stage('Update SonarQube Tags') {
// when {
// not {
// environment name: 'SONARQUBE_TAG', value: ''
// }
// buildingTag()
// }
// steps{
// node(label: 'docker') {
// withSonarQubeEnv('Sonarqube') {
// withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GIT_TOKEN')]) {
// sh '''docker pull eeacms/gitflow'''
// sh '''docker run -i --rm --name="${BUILD_TAG}-sonar" -e GIT_NAME=${GIT_NAME} -e GIT_TOKEN="${GIT_TOKEN}" -e SONARQUBE_TAG=${SONARQUBE_TAG} -e SONARQUBE_TOKEN=${SONAR_AUTH_TOKEN} -e SONAR_HOST_URL=${SONAR_HOST_URL} eeacms/gitflow /update_sonarqube_tags.sh'''
// }
// }
// }
// }
// }
stage('Update SonarQube Tags') {
when {
not {
environment name: 'SONARQUBE_TAG', value: ''
}
buildingTag()
}
steps{
node(label: 'docker') {
withSonarQubeEnv('Sonarqube') {
withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GIT_TOKEN')]) {
sh '''docker pull eeacms/gitflow'''
sh '''docker run -i --rm --name="${BUILD_TAG}-sonar" -e GIT_NAME=${GIT_NAME} -e GIT_TOKEN="${GIT_TOKEN}" -e SONARQUBE_TAG=${SONARQUBE_TAG} -e SONARQUBE_TOKEN=${SONAR_AUTH_TOKEN} -e SONAR_HOST_URL=${SONAR_HOST_URL} eeacms/gitflow /update_sonarqube_tags.sh'''
}
}
}
}
}
}


Expand Down
Loading

0 comments on commit 5056f5f

Please sign in to comment.