Skip to content

Commit

Permalink
devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Apr 24, 2024
1 parent fc04875 commit 225fe43
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"build": {
"dockerfile": "Dockerfile"
}
}
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
71 changes: 71 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Use a Debian-based Linux distribution as the base image
FROM --platform=linux/amd64 debian:stable-slim

# Install necessary packages for Rust and Python development
RUN apt-get update && \
apt-get install -y \
curl \
gcc \
libc6-dev \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*

# Install Rust using Rustup
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Add Rust binaries to the PATH
ENV PATH="/root/.cargo/bin:${PATH}"

# Display installed Rust version
RUN rustc --version && cargo --version

# Install dependencies for Pyenv and Python
RUN apt-get update && \
apt-get install -y \
make \
build-essential \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
wget \
curl \
llvm \
libncurses5-dev \
libncursesw5-dev \
xz-utils \
tk-dev \
libffi-dev \
liblzma-dev \
python3-openssl \
git \
&& rm -rf /var/lib/apt/lists/*

# Install Pyenv
RUN curl https://pyenv.run | bash

# Set Pyenv environment variables
ENV PYENV_ROOT="/root/.pyenv"
ENV PATH="$PYENV_ROOT/bin:$PATH"

RUN echo 'export PATH="/root/.pyenv/bin:$PATH"' >> /root/.bashrc && \
echo 'eval "$(pyenv init -)"' >> /root/.bashrc && \
echo 'eval "$(pyenv virtualenv-init -)"' >> /root/.bashrc

# Reload bash
RUN bash -c 'exec $SHELL'

# Install Python 3.9.0 using Pyenv
RUN bash -c 'pyenv install 3.9.0' && \
bash -c 'pyenv global 3.9.0'

# Set the working directory
WORKDIR /workshop

# Copy the application code into the container
COPY . .

# Set the default command to run when the container starts
CMD ["bash"]

0 comments on commit 225fe43

Please sign in to comment.