From 998b8c83a7d3e2ec22a4f963db7df96852385f7c Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 30 Sep 2024 14:30:08 +0200 Subject: [PATCH] feat: refs #6695 prepare to push image --- .dockerignore | 1 + Jenkinsfile | 6 --- back/Dockerfile | 6 +++ back/Dockerfile.test | 75 -------------------------------- docker-compose.test.yml | 25 ----------- docker-compose.yml | 2 +- loopback/server/datasources.json | 2 +- 7 files changed, 9 insertions(+), 108 deletions(-) delete mode 100644 back/Dockerfile.test delete mode 100644 docker-compose.test.yml diff --git a/.dockerignore b/.dockerignore index c61065e3d..c5376b916 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ print/node_modules front e2e +storage diff --git a/Jenkinsfile b/Jenkinsfile index 7130d95aa..21dadd735 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -200,12 +200,6 @@ pipeline { } sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY' sh 'docker-compose push' - script { - if (env.BRANCH_NAME == 'master') { - sh 'docker tag $IMAGE:$TAG $IMAGE:latest' - sh 'docker push $IMAGE:latest' - } - } } } stage('Deploy') { diff --git a/back/Dockerfile b/back/Dockerfile index 363192a0b..82599388b 100644 --- a/back/Dockerfile +++ b/back/Dockerfile @@ -47,14 +47,20 @@ COPY loopback/package.json loopback/ RUN pnpm install --prod COPY loopback loopback +RUN rm loopback/server/datasources.json && mv loopback/server/datasources.docker.json loopback/server/datasources.json + COPY back back +COPY db db +COPY .git .git COPY modules modules COPY print print COPY \ LICENSE \ README.md \ + myt.config.yml \ ./ + CMD ["pm2-runtime", "./back/process.yml"] HEALTHCHECK --interval=15s --timeout=10s \ diff --git a/back/Dockerfile.test b/back/Dockerfile.test deleted file mode 100644 index 4aacd13f7..000000000 --- a/back/Dockerfile.test +++ /dev/null @@ -1,75 +0,0 @@ -FROM debian:bookworm-slim -ENV TZ Europe/Madrid - -ARG DEBIAN_FRONTEND=noninteractive - -# NodeJs - -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - curl \ - ca-certificates \ - gnupg2 \ - graphicsmagick \ - && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ - && apt-get install -y --no-install-recommends nodejs \ - && corepack enable pnpm - -# Puppeteer - -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - libfontconfig lftp xvfb gconf-service libasound2 libatk1.0-0 libc6 \ - libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 \ - libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 \ - libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 \ - libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 \ - libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \ - fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget - -# Extra dependencies - -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - samba-common-bin samba-dsdb-modules\ - && rm -rf /var/lib/apt/lists/* \ - && npm -g install pm2 - -# Salix -WORKDIR /salix - -RUN npm i -g gulp-cli - -COPY print/package.json print/pnpm-lock.yaml print/ -RUN pnpm install --prod --prefix=print - -COPY package.json pnpm-lock.yaml ./ -COPY loopback/package.json loopback/ - -COPY loopback loopback -COPY back back -COPY modules modules -COPY print print -COPY \ - LICENSE \ - README.md \ - gulpfile.js \ - myt.config.yml \ - ./ - -RUN npm install -g gulp-cli -RUN apt-get update && apt-get install -y libkrb5-dev libssl-dev - -RUN apt-get update \ - && apt-get install -y build-essential python3 libssl-dev -RUN pnpm install -RUN pnpm install husky - -COPY db db -COPY front front -COPY storage storage - -RUN gulp install - - -CMD ["pnpx", "gulp", "back"] diff --git a/docker-compose.test.yml b/docker-compose.test.yml deleted file mode 100644 index 4e3f88a9d..000000000 --- a/docker-compose.test.yml +++ /dev/null @@ -1,25 +0,0 @@ -services: - front: - image: registry.verdnatura.es/salix-front:${VERSION:?} - build: - context: front - back: - image: registry.verdnatura.es/salix-back:${VERSION:?} - build: - context: . - dockerfile: back/Dockerfile - depends_on: - - db - ports: - - 3000:3000 - volumes: - - ./storage:/salix/storage - db: - image: db - command: npx myt run -t -d --ci -n salix_default - build: - context: . - dockerfile: db/Dockerfile - target: db - volumes: - - /var/run/docker.sock:/var/run/docker.sock diff --git a/docker-compose.yml b/docker-compose.yml index e27071dbc..923bb5780 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,4 +8,4 @@ services: image: registry.verdnatura.es/salix-back:${VERSION:?} build: context: . - dockerfile: back/Dockerfile.test + dockerfile: back/Dockerfile diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 60f3f8b27..46017a85a 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -7,7 +7,7 @@ "connector": "vn-mysql", "database": "vn", "debug": false, - "host": "vn-database", + "host": "localhost", "port": "3306", "username": "root", "password": "root",