diff --git a/docker-compose.yml b/docker-compose.yml index 9aa66233..4423cac7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -122,10 +122,11 @@ services: test: build: context: . - dockerfile: tests.Dockerfile + dockerfile: serve.Dockerfile + target: tests volumes: - - ./tests:/app/tests - - ./package.json:/app/package.json - - ./package-lock.json:/app/package-lock.json + - ./tests:/app/src/tests + - ./package.json:/app/src/package.json + - ./package-lock.json:/app/src/package-lock.json profiles: - manual diff --git a/serve.Dockerfile b/serve.Dockerfile index 01f3ee00..5bf2e04f 100644 --- a/serve.Dockerfile +++ b/serve.Dockerfile @@ -5,7 +5,7 @@ WORKDIR /app/src # Install dependencies COPY package.json package-lock.json ./ -RUN npm install +RUN npm ci # Copy rest of the app source COPY . /app/src @@ -27,4 +27,9 @@ RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* # COPY _site /var/www/html/ COPY .github/scripts/staging/default.conf /usr/local/apache2/conf/httpd.conf +FROM base AS tests + +# Set default command to run BDD tests +CMD ["npm", "run", "test:bdd"] + FROM base diff --git a/tests.Dockerfile b/tests.Dockerfile deleted file mode 100644 index 5975fc5f..00000000 --- a/tests.Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:18-alpine - -WORKDIR /app - -# Copy package files and install dependencies -COPY package*.json ./ -RUN npm ci - -# Copy test files and the necessary scripts from package.json -COPY tests/ ./tests/ - -# Set default command to run BDD tests -CMD ["npm", "run", "test:bdd"] \ No newline at end of file