Overview
Step-by-step instructions for building an image to provide for deployment in eyk via eyk builds:create
.
Solution
These are the main steps for preparing and deploying an application to the EYK using a Docker image:
- Prepare the Dockerfile
- Install bash if it is not shipped with the base image
- EXPOSE <port> (only single port should be exposed)
- CMD (directive to define the default process that will run within the container)
Sample Dockerfile
FROM alpine
RUN apk update
RUN apk upgrade
RUN apk add --no-cache bash nginx
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] - Build image and push to your docker registry:
docker build -t <docker image url> :<tag> <Path to directory containing the Dockerfile>
docker push <docker image url> :<tag>
- Create the application:
eyk apps:create <application name> --no-remote
- Add the Docker registry credentials which EYK can use to pull the image during the deployment (not required for public images).
eyk config:set PORT=<EXPOSE Port> -a <application name>
eyk registry:set -a <application name> username=<docker-registry-username> password=<docker-registry-password>
- Deploy the application:
eyk builds:create <docker image url> :<tag> -a <application name>
This creates a new build of an application, imports an image and deploys it to EYK as a new release. If your Dockerfile does not have CMD set for whatever reason, you can set the same via--procfile
as follows:eyk builds:create <docker image url> :<tag> -a <application name> --procfile='<process type>:<docker cmd>'
Note:
- The above steps should also work for an existing application but it is recommended to always check this on staging to iron out any issues that may arise.
- The --profile command argument does not accept multiple process types the way using a Procfile with a git push does. It is possible, however, to use a Dockerfile with basically enough lines to pull the already existing image and define 'CMD', and then 'git push' it to EYK alongside a crafted Procfile.
- EYK cannot at the moment pull images from Amazon ECR (Elastic Container Registry) due to ECR having ephemeral tokens for authentication. Support for ECR is currently on the roadmap but at the moment EYK supports only repositories using fixed tokens/credentials, such as Docker Hub.
Comments
Article is closed for comments.