Giter Site home page Giter Site logo

42_linux_devcontainer's Introduction

Configuración del Contenedor de Desarrollo

Este repositorio contiene una carpeta .devcontainer que te permite configurar un entorno de desarrollo utilizando la extensión Remote - Containers de Visual Studio Code.

Prerrequisitos

Antes de comenzar, asegúrate de tener instalado lo siguiente en tu sistema:

Antes de empezar SOLO para usuarios de Podman

Un poco de preparación es necesaria para engañar a VSCode para usar Podman en lugar de Docker. Puedes usar este pequeño script (copiar/pegar en tu terminal) para hacerlo:

#!/bin/bash

# Create a local bin directory
echo "Creating ~/bin directory if it doesn't exist..."
mkdir -p ~/bin

# Navigate to the directory
cd ~/bin

# Create a Docker wrapper script for Podman
echo "Creating Docker wrapper script for Podman..."
cat > docker << EOF
#!/bin/bash
podman "\$@"
EOF

# Make the script executable
chmod +x docker
echo "Docker wrapper script created."

# Add the local bin directory to your PATH
SHELL_PROFILE=""
if [ -n "$ZSH_VERSION" ]; then
   SHELL_PROFILE="$HOME/.zshrc"
elif [ -n "$BASH_VERSION" ]; then
   SHELL_PROFILE="$HOME/.bash_profile"
fi

if [ -n "$SHELL_PROFILE" ]; then
    if ! grep -q 'export PATH=~/bin:$PATH' "$SHELL_PROFILE"; then
        echo "Adding ~/bin to your PATH in $SHELL_PROFILE..."
        echo 'export PATH=~/bin:$PATH' >> "$SHELL_PROFILE"
        source $SHELL_PROFILE
        echo "Path added and sourced\!"
    else
        echo "~/bin is already in your PATH."
    fi
else
    echo "Could not determine shell profile file."
fi

WARNING: Este script hará que todos los futuros comandos docker utilicen podman en lugar de docker. Para deshacerlo, simplemente ejecute rm -f ~/bin/docker y todo volverá a la normalidad.

Empezar

Para utilizar este contenedor de desarrollo en tu propio repositorio, sigue estos pasos:

  1. Clona este repositorio:

    git clone https://github.com/42-Madrid-Fundacion-Telefonica/42_linux_devcontainer.git
  2. Copia la carpeta .devcontainer a la raíz de tu repositorio de proyecto.

  3. Abre tu proyecto en Visual Studio Code.

  4. Visual Studio Code debería detectar la configuración del contenedor de desarrollo en tu proyecto y te pedirá que vuelvas a abrir el proyecto en un contenedor. Alternativamente, puedes abrir la Paleta de Comandos (Ctrl+Shift+P) y seleccionar Remote-Containers: Reopen in Container.

  5. Espera a que Visual Studio Code construya el contenedor de Docker y configure el entorno de desarrollo.

  6. Una vez que el contenedor esté construido y el entorno esté configurado, puedes empezar a codificar dentro del contenedor de desarrollo.

Configuración Adicional (Opcional)

  • Puedes personalizar el contenedor de desarrollo modificando el archivo devcontainer.json dentro de la carpeta .devcontainer. Consulta la documentación oficial para obtener más información sobre las opciones de configuración disponibles.

Retroalimentación

Si encuentras algún problema o tienes sugerencias para mejorar, por favor abre un issue en este repositorio.

¡A pasarlo bien programando!

Dev Container Setup

This repository contains a .devcontainer folder which allows you to set up a development environment using Visual Studio Code's Remote - Containers extension.

Prerequisites

Before you begin, make sure you have the following installed on your system:

Before Starting for Podman users ONLY

A little bit of preparation is necessary to trick VSCode to use Podman in place of Docker. You can use this little script (copy/paste it in your terminal) to do it:

#!/bin/bash

# Create a local bin directory
echo "Creating ~/bin directory if it doesn't exist..."
mkdir -p ~/bin

# Navigate to the directory
cd ~/bin

# Create a Docker wrapper script for Podman
echo "Creating Docker wrapper script for Podman..."
cat > docker << EOF
#!/bin/bash
podman "\$@"
EOF

# Make the script executable
chmod +x docker
echo "Docker wrapper script created."

# Add the local bin directory to your PATH
SHELL_PROFILE=""
if [ -n "$ZSH_VERSION" ]; then
   SHELL_PROFILE="$HOME/.zshrc"
elif [ -n "$BASH_VERSION" ]; then
   SHELL_PROFILE="$HOME/.bash_profile"
fi

if [ -n "$SHELL_PROFILE" ]; then
    if ! grep -q 'export PATH=~/bin:$PATH' "$SHELL_PROFILE"; then
        echo "Adding ~/bin to your PATH in $SHELL_PROFILE..."
        echo 'export PATH=~/bin:$PATH' >> "$SHELL_PROFILE"
        source $SHELL_PROFILE
        echo "Path added and sourced\!"
    else
        echo "~/bin is already in your PATH."
    fi
else
    echo "Could not determine shell profile file."
fi

WARNING: This script will cause every futur docker commands to use podman in place of docker. To undo it, simply run rm -f ~/bin/docker and everything will go back to normal.

Getting Started

To use this dev container in your own repository, follow these steps:

  1. Clone this repository:

    git clone https://github.com/42-Madrid-Fundacion-Telefonica/42_linux_devcontainer.git
  2. Copy the .devcontainer folder to the root of your project repository.

  3. Open your project in Visual Studio Code.

  4. Visual Studio Code should detect the dev container configuration in your project and prompt you to reopen the project in a container. Alternatively, you can open the Command Palette (Ctrl+Shift+P) and select Remote-Containers: Reopen in Container.

  5. Wait for Visual Studio Code to build the Docker container and set up the development environment.

  6. Once the container is built and the environment is set up, you can start coding inside the dev container.

Additional Configuration (Optional)

  • You can customize the dev container by modifying the devcontainer.json file inside the .devcontainer folder. Refer to the official documentation for more information on available configuration options.

Feedback

If you encounter any issues or have suggestions for improvement, please open an issue on this repository.

Happy coding!

42_linux_devcontainer's People

Contributors

bazuara avatar steamopollys avatar

Stargazers

JuanAnt0ni0 avatar Julio Pinedo avatar  avatar Fernando Ballesteros avatar rvela-ca avatar Fede avatar  avatar José Eduardo Rodríguez Fernández  avatar Juan Ariza avatar Adrian Skar avatar  avatar

Watchers

 avatar

Forkers

steamopollys

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.