Dockerizing
The services that you are building need to be packaged as Docker container images. For that, you do not need to write a
Dockerfile
or anything like that. We already have pre-defined types of Docker image packaging that you should use.You need to ask the DevOps team to create a Docker repository for you, which has the same name your service has in NX. This is an important convention to make everyone's lives easier. Then you need to manually add to your project's
project.json
file a target that describes what kind of Docker packaging it needs. For example, adding this target "docker-next": {}
means your service will be packaged as a NextJS Docker container image. We have support the following types of Docker containers:
docker-static
, suitable for serving all types of static content. Suitable for pure HTML or React SPAs.docker-cypress
, suitable for running cypress tests in docker.docker-native
, not implemented
If you would like to see some examples, simply search for "docker" in that file and you should find plenty.
When you push this change to
main
your Docker image will get built and pushed to our private central Docker registryPrerequisite: Local Docker support
If you are having problems with your application running inside a Docker container, you can troubleshoot that by downloading the Docker container and running it locally on your workstation.
To do that you need to follow this process:
- 1.Login to our AWS Shared account and get command line access settingsLoginEnv copy
- 2.Open your terminal and paste the AWS creds from the clipboard
- 3.Run this to authenticate to our private Docker registryaws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 821090935708.dkr.ecr.eu-west-1.amazonaws.com
- 4.Now you can poke around in the Docker container like this (Docker image and tag can be retrieved from a few places, depending on where you are starting from - Spinnaker, GitHub CI, Kubenav/Kubernetes)docker run --rm -it --entrypoint=sh 821090935708.dkr.ecr.eu-west-1.amazonaws.com/<image>:<tag>
Last modified 4mo ago