I am trying to create a multi stage Dockerfile, where the first stage is meant to be started in development environment (simple dev server) and the second stage is meant for production (full size web server).
FROM python:3.9-alpine3.14 as develop
...
CMD python manage.py runserver 0.0.0.0:8000
FROM python:3.9-alpine3.14 as production
...
CMD gunicorn -b 0.0.0.0:8000 backend.wsgi
I am trying to specify the target stage in docker-compose.yml like so:
version: '3.7'
services:
backend:
build:
target: develop
...
But it does not have any effect. Even when I set the target to OohEehOohAhAahTingTangWallaWallaBingBang, there is no error and the production server (last stage in Dockerfile) starts.
So, how to specify which target should be started in docker-compose.yml ?
EDIT: I am using WSL (Windows Subsystem for Linux) with Ubuntu-20.04
$ docker-compose --version
Docker Compose version v2.0.0-rc.1