Changing from python:3-alpine image to python:3.8-slim in Devspace

579 views Asked by At

I am having Issues with installing pip dependancies within my devImage. I was wondering if instead of using devImage: ghcr.io/loft-sh/devspace-containers/python:3-alpine I could use something like devImage: ghcr.io/loft-sh/devspace-containers/python:3.8-slim??

Or how would I just use my normal Docker image that I have made?

Specific issues with numpy/pandas and streamlit packages.

The documentation on devspace isn't very helpful.

I believe I need to change the config in my devspace.yaml file. If anyone has a good tutorial to do this on with python that would be amazing

I have tried installing lots of things with apk which may have worked however using alpine seems to be increibly slow.

FYI. I am on MacOS

1

There are 1 answers

0
carlm On

Yes, you can absolutely use whatever image you want -- the example/pre-canned devspace containers that are published are just a starting point for you.

There is a python specific example here that covers everything you should need.

TL:DR -- build your image with whatever you want in it, and set that image as the image in your deployment and/or dev sections of the devspace.yaml file. You can have devspace build the image for you as well by setting the appropriate image block with your docker file/context/and image name.

An example devspace.yaml:

version: v2beta1
name: myapp

vars:
  MYIMAGE: myimagename
  MYDEVIMAGE: mydevimagename

images:
  myapp:
    image: ${MYIMAGE}
    context: ./
    dockerfile: ./Dockerfile
    rebuildStrategy: ignoreContextChanges

  myappdev:
    image: ${MYDEVIMAGE}
    context: ./
    dockerfile: ./Dockerfile.dev
    rebuildStrategy: ignoreContextChanges

deployments:
  myapp:
    # you can also use manifests instead of helm charts, see devspace docs, its all covered there
    helm:
      chart:
        name: ./path/to/my/chart 

dev:
  myapp:
    labelSelector:
      app: myapp
    devImage: ${MYDEVIMAGE}
    # other dev things like sync and terminal as needed