I have a Dockerfile with two stages; the first stage builds a react app from source and the second stage copies that build and adds an NGINX server:
FROM kkarczmarczyk/node-yarn as builder
COPY . /workspace
RUN set -ex \
yarn global add create-react-app \
&& yarn install \
&& GENERATE_SOURCEMAP=false yarn build
FROM nginx:mainline-alpine
COPY ./nginx-default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /workspace/build /var/www/html/
I'm also using gitlab-ci, and I'd like to have multiple stages: build, test and deploy. But I don't know how to split the build and test stage since I'm using a multistage Dockerfile. The issue there is that all the JS tests (for React) need to be run before "yarn build" gets executed and the build gets copied over to the seconds docker stage.
A solution could be to just execute yarn test
before yarn build
gets run. But I really would like to have a separate test gitlab-ci stage.
Is this possible? Or do I need to split my Dockerfile stages into multiple Dockerfiles?
Aucun commentaire:
Enregistrer un commentaire