CRA apps can be deployed using docker easily. If you don't need the SSR, the image is very small and nginx footprint is very low.
Basically all You need is to create Dockerfile for building you app:
FROM inloopx/cra-docker
COPY build /app
Then the pipeline configuration in .gitlab-ci.yml should look like this to build your image and push it to gitlab registry:
stages:
- compile
- build
compile:
image: node:8.4.0
stage: compile
tags:
- docker
artifacts:
expire_in: 10 minutes
paths:
- build/
script:
# you can also use `npm install` and `npm run build`
- yarn install
- yarn build
build:
image: inloopeu/devops
stage: build
tags:
- docker
services:
- docker:dind
script:
- devops gitlab docker build
NOTE: image inloopx/cra-docker is used, you can find more info at https://github.com/inloop/cra-docker
NOTE2: images are tagged automatically, read more in Docker image tagging
NOTE3: Image is built using https://github.com/novacloudcz/devopscli which is our tool to ease the deployment tasks