BLD: Refactor Dockerfile to not install dev enviornment on base
State: closed

- [x] closes #48382 (Replace xxxx with the Github issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

* Ensure packages are installed with `--no-install-recommends` and remove some unnecessary packages (saves ~0.7GB)
* Add smoke test to show `pandas-dev` environment is installed.


Labels:
name: Build
description: Library building on various platforms

Comments:
docbuild fail looks like its happening on all PRs

```
Exception in /home/runner/work/pandas/pandas/doc/source/user_guide/timeseries.rst at block ending on line 2001
Specify :okexcept: as an option in the ipython:: block to suppress this message
  Cell In [360], line 2
    p == pd.Period("2012-01", freq="3M")
    ^
SyntaxError: invalid syntax

```

The preceeding line is `@okexcept`, which maybe should be `:okexcept:`? but the `@` isn't a recent change, so no idea why it just started complaining
> docbuild fail looks like its happening on all PRs

Yeah it seems the core issue is somewhat known in https://github.com/pandas-dev/pandas/issues/48431
Merging as the Docker build check passed: https://github.com/pandas-dev/pandas/runs/8232582540?check_suite_focus=true
@phofl do you think we should backport as you backported your pinning of this Docker image to 1.5?

This PR does a little more than just revert the pin.
+1 on backport in general

Different question: We have 2 environments inside the Dockerfile now, correct?
Are we ok with the increased size?
> We have 2 environments inside the Dockerfile now, correct?

Yes. Technically there is a workflow change for users that develop using the container (need to activate pandas-dev now). But IMO probably more sane for users to still have access to the `base` environment

> Are we ok with the increased size?

I personally don't use the container for development so I don't have a strong opinion. Since this isn't a production image per se, I think any size changes should be okay?
I am not using it either, shouldn't be an issue in general I think. It's not deployed on machines with limited disk space (probably :))

Can we promote this a bit more offensive? Whatsnew is the wrong place probably?
I can add a small whatsnew note. If we backport to 1.5, the additional instructions I added will be available by default once 1.5 is release as opposed to users needing to navigate to the `dev` tab.
Greenish, merging.
Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
git checkout 1.5.x
git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
git cherry-pick -x -m1 78a5f7193cfc05640f83818cff0ee586a61ff3be
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
git commit -am 'Backport PR #48427: BLD: Refactor Dockerfile to not install dev enviornment on base'
```

4. Push to a named branch:

```
git push YOURFORK 1.5.x:auto-backport-of-pr-48427-on-1.5.x
```

5. Create a PR against branch 1.5.x, I would have named this PR:

> "Backport PR #48427 on branch 1.5.x (BLD: Refactor Dockerfile to not install dev enviornment on base)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the `Still Needs Manual Backport` label once the PR gets merged.

If these instructions are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).