I am trying to use the image being built to add the required test setup in order to run my tests.
But no matter what I try, using IMAGE_NAME or CACHE_TAG doesn’t result in a correct build.
It is definitely working on my localhost
docker build . -t local:local
IMAGE_NAME=local:local CACHE_TAG=3d860f364c40 docker-compose -f docker-compose.test.yml run --rm sut
Is this setup even possible on docker cloud?
Here is my docker-compose.test.yml
file
version: '3.2'
services:
sut:
build:
context: .
cache_from: ${CACHE_TAG}
dockerfile: Dockerfile.test
args:
IMAGE_NAME: ${IMAGE_NAME}
And here is my Dockerfile.test
ARG IMAGE_NAME
FROM $IMAGE_NAME
ENV NODE_ENV test
RUN cd /app && npm install --dev
COPY ./test /app/test
CMD ["npm", "test"]