Split containers: separate dev / prod containers
For application development in containers, you want an environment that you can freely mess around in, has development dependencies and possibly even credentials to push directly to a repository.
GitLab can provide default development container images that allow you to quickly work on a project. In the projects repository you then work on building a production container
A way to specify a development container, such as the following in
development: - ruby-on-rails
Which will spin up a container for you with this image, that you can open a terminal for to do development in. The container has ssh credentials, so you can push to GitLab.
In the future, a Web IDE or local IDE could connect to this container to provide your entire dev environment.
You can also specify your own container for development:
development: - registry.domain.com/jobs-website-dev
I think @ayufan solved the problem of the difference between development and production container images with https://gitlab.com/gitlab-examples/openshift-deploy/blob/master/README.md
The repository that contains the code is used for development and to build a production container, the production container image is added to the container repository. So we can install git credentials to the development container.
I name this practice 'split container'. It means you have two containers:
- The development one, this has all development dependencies, similar to registry.gitlab.com/gitlab-examples/openshift-deploy
- The production one, this is the container that is added to the registry under the project name
GitLab will provide development containers for all common platforms. You can also provide your own development container by specifying it in .gitlab-ci.yml. But the repo and images of your custom container are not related to your application code. This because you can reuse the development container across different projects.
I've described how to deploy with PostgreSQL and Redis in https://gitlab.com/gitlab-org/gitlab-ce/issues/26453 and will rename this issue to discuss split containers.
When you create a project, select the auto deploy template, and press the terminal button it should be possible to get the development container. Maybe we can define a 'development' stage in our template to accommodate this.