Added devcontainer config and docker with development environment

This commit is contained in:
2025-03-31 21:48:22 +02:00
parent 9cd5b759a9
commit bb0450ad69
2 changed files with 87 additions and 0 deletions

62
.devcontainer/Dockerfile Normal file
View File

@@ -0,0 +1,62 @@
# Use the official Alpine Linux image
FROM alpine:3.21
# Install dependencies for Android SDK and Qt build tools
RUN apk update && \
apk add --no-cache \
bash \
build-base \
cmake \
git \
curl \
unzip \
openjdk17 \
libx11 \
libxcomposite \
libxrandr \
libxcursor \
libxi \
mesa-dev \
libusb
# Set environment variables for Qt and Android SDK
ENV QT_VERSION=6.8.0
ENV QT_INSTALL_PATH=/opt/qt-${QT_VERSION}
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk
ENV ANDROID_SDK_ROOT=/opt/android-sdk
ENV PATH="${QT_INSTALL_PATH}/bin:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${ANDROID_SDK_ROOT}/platform-tools:${ANDROID_SDK_ROOT}/emulator:${ANDROID_SDK_ROOT}/tools:${ANDROID_SDK_ROOT}/tools/bin:${JAVA_HOME}/bin:$PATH"
# Download and install Qt 6.8.0 from the official Qt website
RUN mkdir -p ${QT_INSTALL_PATH} && \
cd ${QT_INSTALL_PATH} && \
wget https://download.qt.io/archive/qt/6.8/6.8.0/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \
tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz && \
rm qt-everywhere-src-${QT_VERSION}.tar.xz && \
cd qt-everywhere-src-${QT_VERSION} && \
./configure -prefix ${QT_INSTALL_PATH} -nomake examples -nomake tests -optimized-qmake && \
make -j$(nproc) && \
make install
# Install Android SDK Command Line Tools
RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools && \
curl -o sdk-tools-linux.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip && \
unzip sdk-tools-linux.zip -d ${ANDROID_SDK_ROOT}/cmdline-tools && \
rm sdk-tools-linux.zip && \
mv ${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest
# Install required Android SDK components
RUN yes | sdkmanager --licenses && \
sdkmanager --update && \
sdkmanager "platform-tools" "platforms;android-33" "build-tools;33.0.2"
# Verify SDK installation
RUN sdkmanager --list
# Set working directory
WORKDIR /workspace
# Expose ADB debugging port
EXPOSE 5555
# Start bash as the default command
CMD ["/bin/bash"]

View File

@@ -0,0 +1,25 @@
{
"name": "Qt 6.8.0 Development Container",
"build": {
"dockerfile": "Dockerfile",
"context": "."
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"ms-vscode.makefile-tools",
"androidtool.android",
"ms-azuretools.vscode-docker"
]
}
},
"forwardPorts": [8080],
"mounts": [
"source=${localWorkspaceFolder},target=/workspace,type=bind"
]
}