From 7ddcb1b83f3e4e86d55189832bc91eb22b054b8d Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 30 Sep 2024 09:00:59 +0200 Subject: [PATCH] feat: refs #6695 run db in docker --- db/Dockerfile | 27 ++++++++++++--------------- docker-compose.test.yml | 15 +++++++++------ loopback/server/datasources.json | 28 ++++++++++++++-------------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/db/Dockerfile b/db/Dockerfile index 79160940f..e456ddf54 100644 --- a/db/Dockerfile +++ b/db/Dockerfile @@ -1,32 +1,29 @@ -FROM node:20-bullseye AS base -# FROM back AS base +FROM docker:dind AS base ENV TZ Europe/Madrid ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - libkrb5-dev libssl-dev +RUN apk update \ + && apk add --update nodejs npm python3 \ + krb5-dev libressl-dev + +RUN apk update \ + && apk add --virtual build-dependencies \ + build-base gcc wget git + RUN npm i -g pnpm WORKDIR /salix COPY db db -# COPY node_modules node_modules +COPY node_modules node_modules +COPY .git .git COPY myt.config.yml . -# RUN ls -RUN pnpm i @verdnatura/myt +# RUN pnpm i @verdnatura/myt FROM base AS db WORKDIR /salix -# RUN cat myt.config.yml -# RUN ls -# RUN cd db -# RUN ls -RUN usermod -aG docker $USER -# RUN npx myt run -d -CMD ["npx", "myt", "run", "-d"] diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 4e85a0fbe..4e3f88a9d 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -1,4 +1,3 @@ -version: '3.7' services: front: image: registry.verdnatura.es/salix-front:${VERSION:?} @@ -9,14 +8,18 @@ services: build: context: . dockerfile: back/Dockerfile - # volumes: - # - ./storage:/salix/storage + 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 - # user: root + volumes: + - /var/run/docker.sock:/var/run/docker.sock diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index f1643e522..60f3f8b27 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -7,7 +7,7 @@ "connector": "vn-mysql", "database": "vn", "debug": false, - "host": "localhost", + "host": "vn-database", "port": "3306", "username": "root", "password": "root", @@ -121,19 +121,19 @@ "video/mp4" ] }, - "supplierStorage": { - "name": "supplierStorage", - "connector": "loopback-component-storage", - "provider": "filesystem", - "root": "./storage/dms", - "maxFileSize": "31457280", - "allowedContentTypes": [ - "image/png", - "image/jpeg", - "image/jpg", - "image/webp", - "video/mp4", - "application/pdf" + "supplierStorage": { + "name": "supplierStorage", + "connector": "loopback-component-storage", + "provider": "filesystem", + "root": "./storage/dms", + "maxFileSize": "31457280", + "allowedContentTypes": [ + "image/png", + "image/jpeg", + "image/jpg", + "image/webp", + "video/mp4", + "application/pdf" ] }, "accessStorage": {