-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile.local-dev
81 lines (75 loc) · 2.91 KB
/
Dockerfile.local-dev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Remote development container for VS Code and CLion
#
# Build and run:
# docker build -t gentool-devcontainer -f Dockerfile.local-dev .
# docker run -d --cap-add sys_ptrace -p127.0.0.1:2222:22 --name gentool-devcontainer
# ssh-keygen -f "$HOME/.ssh/known_hosts" -R "[localhost]:2222"
#
# stop:
# docker stop gentool-devcontainer
#
# ssh credentials (test user):
# user@password
ARG UBUNTU_VERSION=21.10
FROM ubuntu:${UBUNTU_VERSION} AS base_deps
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
tzdata \
ssh \
git \
curl wget \
tar zip unzip \
rsync \
python3 python-is-python3 pip \
ninja-build make \
libxml2 \
&& apt-get clean
# Download prebuilt LLVM from Github, extract to "/usr" directory, set "lld" as default linker
FROM base_deps AS llvm_deps
ARG LLVM_GITHUB_RELEASE_TAG=llvmorg-12.0.1-rc1
ARG LLVM_GITHUB_RELEASE_FILENAME=clang+llvm-12.0.1-rc1-x86_64-linux-gnu-ubuntu-21.04
RUN set -ex \
&& apt-get install xz-utils \
&& wget -O llvm-clang.tar.xz https://github.com/llvm/llvm-project/releases/download/${LLVM_GITHUB_RELEASE_TAG}/${LLVM_GITHUB_RELEASE_FILENAME}.tar.xz \
&& tar -xvf llvm-clang.tar.xz \
&& cp -R ./${LLVM_GITHUB_RELEASE_FILENAME}/* /usr \
&& rm ./llvm-clang.tar.xz \
&& rm -rf ./${LLVM_GITHUB_RELEASE_FILENAME} \
&& update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/lld" 50
# Install LDC
FROM llvm_deps AS dlang_deps
ARG D_VERSION=ldc-1.26.0
ARG DPATH=/dlang
RUN set -ex \
&& mkdir ${DPATH} \
&& curl -fsS https://dlang.org/install.sh | bash -s ${D_VERSION} -p ${DPATH} \
&& chmod 755 -R ${DPATH} \
&& ln -s ${DPATH}/${D_VERSION} ${DPATH}/dc \
&& ls ${DPATH}
ENV PATH="${DPATH}/${D_VERSION}/bin:${PATH}"
ENV LIBRARY_PATH="${DPATH}/${D_VERSION}/lib:${LIBRARY_PATH}"
ENV LD_LIBRARY_PATH="${DPATH}/${D_VERSION}/lib:${LD_LIBRARY_PATH}"
FROM dlang_deps AS build_tools_deps
ARG CMAKE_VERSION=3.20.3
RUN set -ex \
# GCC (for vcpkg install)
&& apt-get install -y --no-install-recommends build-essential \
# CMake
&& wget -O cmake-${CMAKE_VERSION}-Linux-x86_64.sh https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh \
&& sh cmake-${CMAKE_VERSION}-Linux-x86_64.sh -- --skip-license --prefix=/usr \
&& rm -f cmake-${CMAKE_VERSION}-Linux-x86_64.sh \
# vcpkg
&& git clone --depth=1 https://github.com/microsoft/vcpkg \
&& ./vcpkg/bootstrap-vcpkg.sh -useSystemBinaries
FROM dlang_deps AS remote_dev_ssh_deps
RUN ( \
echo 'LogLevel DEBUG2'; \
echo 'PermitRootLogin yes'; \
echo 'PasswordAuthentication yes'; \
echo 'Subsystem sftp /usr/lib/openssh/sftp-server'; \
) > /etc/ssh/sshd_config_test_clion \
&& mkdir /run/sshd
RUN useradd -m user \
&& yes password | passwd user
RUN usermod -s /bin/bash user
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config_test_clion"]