modernize devcontainer

pull/7102/head
Nils Dijk 2023-07-05 16:56:03 +00:00
parent b5471736ff
commit 63fa3e1567
5 changed files with 103 additions and 37 deletions

View File

@ -1,16 +1,55 @@
{ {
"configurations": [ "configurations": [
{ {
"name": "Citus Development Configuration", "name": "Citus Development Configuration - Postgres 15.3",
"includePath": [ "includePath": [
"/usr/local/include", "/usr/local/include",
"${workspaceFolder}/**", "/home/citus/.pgenv/src/postgresql-15.3/src/**",
"/home/citus/.pgenv/src/postgresql-14.2/src/", "${workspaceFolder}/**",
"/home/citus/.pgenv/src/postgresql-14.2/src/include/", "${workspaceFolder}/src/include/",
"/home/citus/.pgenv/src/postgresql-14.2/src/interfaces/libpq/", ],
"${workspaceFolder}/src/include/", "configurationProvider": "ms-vscode.makefile-tools"
] },
} {
], "name": "Citus Development Configuration - Postgres 14.8",
"version": 4 "includePath": [
"/usr/local/include",
"/home/citus/.pgenv/src/postgresql-14.8/src/**",
"${workspaceFolder}/**",
"${workspaceFolder}/src/include/",
],
"configurationProvider": "ms-vscode.makefile-tools"
},
{
"name": "Citus Development Configuration - Postgres 13.11",
"includePath": [
"/usr/local/include",
"/home/citus/.pgenv/src/postgresql-13.11/src/**",
"${workspaceFolder}/**",
"${workspaceFolder}/src/include/",
],
"configurationProvider": "ms-vscode.makefile-tools"
},
{
"name": "Citus Development Configuration - Postgres 12.15",
"includePath": [
"/usr/local/include",
"/home/citus/.pgenv/src/postgresql-12.15/src/**",
"${workspaceFolder}/**",
"${workspaceFolder}/src/include/",
],
"configurationProvider": "ms-vscode.makefile-tools"
},
{
"name": "Citus Development Configuration - Postgres 16beta2",
"includePath": [
"/usr/local/include",
"/home/citus/.pgenv/src/postgresql-16beta2/src/**",
"${workspaceFolder}/**",
"${workspaceFolder}/src/include/",
],
"configurationProvider": "ms-vscode.makefile-tools"
},
],
"version": 4
} }

6
.devcontainer/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"files.exclude": {
"**/*.o": true,
"**/.deps/": true
}
}

View File

@ -52,11 +52,9 @@ USER citus
# build postgres versions separately for effective parrallelism and caching of already built versions when changing only certain versions # build postgres versions separately for effective parrallelism and caching of already built versions when changing only certain versions
FROM base AS pg12 FROM base AS pg12
RUN pgenv build 12.10 RUN pgenv build 12.15
RUN rm .pgenv/src/*.tar* RUN rm .pgenv/src/*.tar*
# TODO remove excessive artifacts for smaller images RUN make -C .pgenv/src/postgresql-*/ clean
RUN find .pgenv/src/ -name "*.o" | xargs rm
#RUN #make -C .pgenv/src/postgresql-*/ clean
# create a staging directory with all files we want to copy from our pgenv build # create a staging directory with all files we want to copy from our pgenv build
# we will copy the contents of the staged folder into the final image at once # we will copy the contents of the staged folder into the final image at once
@ -65,11 +63,9 @@ RUN cp -r .pgenv/src .pgenv/pgsql-* .pgenv/config .pgenv-staging/
RUN rm .pgenv-staging/config/default.conf RUN rm .pgenv-staging/config/default.conf
FROM base AS pg13 FROM base AS pg13
RUN pgenv build 13.6 RUN pgenv build 13.11
RUN rm .pgenv/src/*.tar* RUN rm .pgenv/src/*.tar*
# TODO remove excessive artifacts for smaller images RUN make -C .pgenv/src/postgresql-*/ clean
RUN find .pgenv/src/ -name "*.o" | xargs rm
#RUN make -C .pgenv/src/postgresql-*/ clean
# create a staging directory with all files we want to copy from our pgenv build # create a staging directory with all files we want to copy from our pgenv build
# we will copy the contents of the staged folder into the final image at once # we will copy the contents of the staged folder into the final image at once
@ -78,11 +74,31 @@ RUN cp -r .pgenv/src .pgenv/pgsql-* .pgenv/config .pgenv-staging/
RUN rm .pgenv-staging/config/default.conf RUN rm .pgenv-staging/config/default.conf
FROM base AS pg14 FROM base AS pg14
RUN pgenv build 14.2 RUN pgenv build 14.8
RUN rm .pgenv/src/*.tar* RUN rm .pgenv/src/*.tar*
RUN find .pgenv/src/ -name "*.o" | xargs rm RUN make -C .pgenv/src/postgresql-*/ clean
# TODO remove excessive artifacts for smaller images
#RUN make -C .pgenv/src/postgresql-*/ clean # create a staging directory with all files we want to copy from our pgenv build
# we will copy the contents of the staged folder into the final image at once
RUN mkdir .pgenv-staging/
RUN cp -r .pgenv/src .pgenv/pgsql-* .pgenv/config .pgenv-staging/
RUN rm .pgenv-staging/config/default.conf
FROM base AS pg15
RUN pgenv build 15.3
RUN rm .pgenv/src/*.tar*
RUN make -C .pgenv/src/postgresql-*/ clean
# create a staging directory with all files we want to copy from our pgenv build
# we will copy the contents of the staged folder into the final image at once
RUN mkdir .pgenv-staging/
RUN cp -r .pgenv/src .pgenv/pgsql-* .pgenv/config .pgenv-staging/
RUN rm .pgenv-staging/config/default.conf
FROM base AS pg16
RUN pgenv build 16beta2
RUN rm .pgenv/src/*.tar*
RUN make -C .pgenv/src/postgresql-*/ clean
# create a staging directory with all files we want to copy from our pgenv build # create a staging directory with all files we want to copy from our pgenv build
# we will copy the contents of the staged folder into the final image at once # we will copy the contents of the staged folder into the final image at once
@ -112,7 +128,7 @@ RUN yes | sudo unminimize
# install developer productivity tools # install developer productivity tools
RUN sudo apt update \ RUN sudo apt update \
&& sudo apt install -y \ && sudo apt install -y \
autoconf \ autoconf2.69 \
bash-completion \ bash-completion \
gdb \ gdb \
htop \ htop \
@ -121,12 +137,6 @@ RUN sudo apt update \
vim \ vim \
&& sudo apt clean && sudo apt clean
COPY --from=pg12 /home/citus/.pgenv-staging/ /home/citus/.pgenv/
COPY --from=pg13 /home/citus/.pgenv-staging/ /home/citus/.pgenv/
COPY --from=pg14 /home/citus/.pgenv-staging/ /home/citus/.pgenv/
COPY --from=uncrustify-builder /uncrustify/usr/ /usr/
# add some common tools to the final container # add some common tools to the final container
# bin directory for user tools # bin directory for user tools
RUN mkdir .bin RUN mkdir .bin
@ -144,6 +154,14 @@ RUN git clone https://github.com/so-fancy/diff-so-fancy.git \
&& git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX" \ && git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX" \
&& git config --global interactive.diffFilter "diff-so-fancy --patch" && git config --global interactive.diffFilter "diff-so-fancy --patch"
COPY --from=uncrustify-builder /uncrustify/usr/ /usr/
COPY --from=pg12 /home/citus/.pgenv-staging/ /home/citus/.pgenv/
COPY --from=pg13 /home/citus/.pgenv-staging/ /home/citus/.pgenv/
COPY --from=pg14 /home/citus/.pgenv-staging/ /home/citus/.pgenv/
COPY --from=pg15 /home/citus/.pgenv-staging/ /home/citus/.pgenv/
COPY --from=pg16 /home/citus/.pgenv-staging/ /home/citus/.pgenv/
# place to run your cluster with citus_dev # place to run your cluster with citus_dev
VOLUME /data VOLUME /data
RUN sudo mkdir /data \ RUN sudo mkdir /data \
@ -152,4 +170,4 @@ RUN sudo mkdir /data \
COPY --chown=citus:citus .psqlrc . COPY --chown=citus:citus .psqlrc .
# sets default pg version # sets default pg version
RUN pgenv switch latest 14 RUN pgenv switch latest 15

View File

@ -1,5 +1,5 @@
init: ../.vscode/c_cpp_properties.json ../.vscode/launch.json init: ../.vscode/c_cpp_properties.json ../.vscode/launch.json ../.vscode/settings.json
../.vscode: ../.vscode:
mkdir ../.vscode mkdir ../.vscode
@ -9,3 +9,6 @@ init: ../.vscode/c_cpp_properties.json ../.vscode/launch.json
../.vscode/c_cpp_properties.json: ../.vscode ../.vscode/c_cpp_properties.json: ../.vscode
cp .vscode/c_cpp_properties.json ../.vscode/c_cpp_properties.json cp .vscode/c_cpp_properties.json ../.vscode/c_cpp_properties.json
../.vscode/settings.json: ../.vscode
cp .vscode/settings.json ../.vscode/settings.json

View File

@ -1,5 +1,5 @@
{ {
"image": "citus/devcontainer:dev-20220513", "image": "citus/devcontainer:dev-20230705",
"runArgs": [ "runArgs": [
"--cap-add=SYS_PTRACE", "--cap-add=SYS_PTRACE",
"--security-opt", "--security-opt",