Skip to content

Commit

Permalink
Initial DevContainer setup
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehaller authored and SebastianSchildt committed Jan 29, 2025
1 parent bd6290a commit e385e7b
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# /********************************************************************************
# * Copyright (c) 2024 Contributors to the Eclipse Foundation
# *
# * See the NOTICE file(s) distributed with this work for additional
# * information regarding copyright ownership.
# *
# * This program and the accompanying materials are made available under the
# * terms of the Apache License 2.0 which is available at
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * SPDX-License-Identifier: Apache-2.0
# ********************************************************************************/

FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm
ARG DEBIAN_FRONTEND=noninteractive
ENV CROSS_CONTAINER_IN_CONTAINER=true
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update -y
RUN apt install software-properties-common build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl git libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev -y

USER vscode
RUN cargo install cross cargo-license cargo-cyclonedx

# Installing pyEnv to set up specific version of Python
ENV HOME=/home/vscode
WORKDIR ${HOME}
RUN git clone --depth=1 https://github.com/pyenv/pyenv.git .pyenv
ENV PYENV_ROOT="${HOME}/.pyenv"
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
ENV PYTHON_VERSION=3.12
RUN pyenv install ${PYTHON_VERSION}
RUN pyenv global ${PYTHON_VERSION}

# Fails due to gpg keyserver not accessible via corporate proxy
# Moved to postStartCommand.sh for DevContainer
# RUN pip install "git+https://github.com/eclipse-kuksa/kuksa-common.git@v1#subdirectory=sbom-tools"
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
"name": "Kuksa DevContainer",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"postStartCommand": "bash .devcontainer/postStartCommand.sh",
"mounts": [
{
"target": "/var/run/docker.sock",
"source": "/var/run/docker.sock",
"type": "bind"
}
]
}
14 changes: 14 additions & 0 deletions .devcontainer/postStartCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# Building all currently supported targets for databroker-cli.
# Uses cross for cross-compiling. Needs to be executed
# before docker build, as docker collects the artifacts
# created by this script
# this needs the have cross, cargo-license and kuksa sbom helper
# installed
#
# SPDX-License-Identifier: Apache-2.0

pip install "git+https://github.com/eclipse-kuksa/kuksa-common.git@v1#subdirectory=sbom-tools"

0 comments on commit e385e7b

Please sign in to comment.