Skip to content

Commit 58f3335

Browse files
committed
feat: add Dockerfile for multi-version Python setup and update devcontainer configuration
1 parent 606d6ae commit 58f3335

File tree

4 files changed

+42
-45
lines changed

4 files changed

+42
-45
lines changed

.devcontainer/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM ubuntu:22.04
2+
3+
# Instalar versiones de Python 3.9, 3.10, 3.11 y 3.12
4+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5+
&& apt-get install -y software-properties-common \
6+
&& add-apt-repository -y ppa:deadsnakes/ppa \
7+
&& apt-get update \
8+
&& apt-get install -y python3.9 python3.10 python3.11 python3.12 \
9+
&& apt-get install -y python3-pip \
10+
# Instalar distutils y setuptools para todas las versiones de Python
11+
&& apt-get install -y python3-distutils python3-setuptools \
12+
&& apt-get install -y python3.9-distutils python3.10-distutils python3.11-distutils python3.12-distutils \
13+
&& apt-get install -y python3.9-dev python3.10-dev python3.11-dev python3.12-dev
14+
15+
# establecer Python 3.12 como predeterminado
16+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 \
17+
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 \
18+
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 3 \
19+
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 4
20+
21+
# Actualizar pip y setuptools
22+
RUN pip install --upgrade pip setuptools wheel
23+
24+
# Instalar tox
25+
RUN pip install tox
26+
27+
# Establecer directorio de trabajo
28+
WORKDIR /workspaces/spade
29+
30+
# No copiar requirements.txt (esto se hará después del montaje)
31+
# Los archivos se montarán automáticamente desde tu directorio local
32+
33+
# Establecer Python 3.12 como predeterminado
34+
ENV PYTHONPATH=/workspaces/spade

.devcontainer/devcontainer.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,25 @@
33
{
44
"name": "SPADE Python 3",
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
6+
//"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
7+
"dockerFile": "Dockerfile",
78

89
// Features to add to the dev container. More info: https://containers.dev/features.
910
// "features": {},
1011

12+
1113
// Use 'forwardPorts' to make a list of ports inside the container available locally.
1214
// "forwardPorts": [],
1315

1416
// Use 'postCreateCommand' to run commands after the container is created.
15-
"postCreateCommand": "chmod +x .devcontainer/postcreate.sh && .devcontainer/postcreate.sh",
17+
"postCreateCommand": "pip install -e .[dev] || pip install -r requirements.txt -r requirements_dev.txt || echo 'No se pudieron instalar las dependencias automáticamente'",
1618
// Configure tool-specific properties.
1719
"customizations": {
1820
"vscode": {
1921
"extensions": [
20-
"GitHub.copilot"
22+
"GitHub.copilot",
23+
"ms-python.python",
24+
"gitlens.vscode-gitlens"
2125
]
2226
}
2327
}

.devcontainer/postcreate.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = docs, py38, py39, py310, py311, py312, lint
2+
envlist = docs, py39, py310, py311, py312, lint
33
isolated_build = false
44

55
[testenv:lint]

0 commit comments

Comments
 (0)