Skip to content

Commit 6c3d26f

Browse files
authored
Merge pull request #1 from cblauvelt/develop
Initial release
2 parents 1066e0e + be0358f commit 6c3d26f

File tree

5 files changed

+209
-0
lines changed

5 files changed

+209
-0
lines changed

.github/workflows/docker-image.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Build the Docker image
16+
run: docker build . --file Dockerfile --tag cblauvelt/vscode-cpp:$(date +%s)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Docker
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
8+
on:
9+
schedule:
10+
- cron: "43 14 * * *"
11+
push:
12+
branches: [main]
13+
# Publish semver tags as releases.
14+
tags: ["v*.*.*"]
15+
pull_request:
16+
branches: [main]
17+
18+
env:
19+
# Use docker.io for Docker Hub if empty
20+
REGISTRY: docker.io
21+
# github.repository as <account>/<repo>
22+
IMAGE_NAME: cblauvelt/vscode-cpp
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
packages: write
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v2
34+
35+
# Login against a Docker registry except on PR
36+
# https://github.com/docker/login-action
37+
- name: Log into registry ${{ env.REGISTRY }}
38+
if: github.event_name != 'pull_request'
39+
uses: docker/login-action@v1
40+
with:
41+
registry: ${{ env.REGISTRY }}
42+
username: ${{ secrets.DOCKERHUB_USERNAME }}
43+
password: ${{ secrets.DOCKERHUB_TOKEN }}
44+
45+
# Extract metadata (tags, labels) for Docker
46+
# https://github.com/docker/metadata-action
47+
- name: Extract Docker metadata
48+
id: meta
49+
uses: docker/metadata-action@v3
50+
with:
51+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
52+
53+
# Build and push Docker image with Buildx (don't push on PR)
54+
# https://github.com/docker/build-push-action
55+
- name: Build and push Docker image
56+
uses: docker/build-push-action@v2
57+
with:
58+
context: .
59+
push: ${{ github.event_name != 'pull_request' }}
60+
tags: ${{ steps.meta.outputs.tags }}
61+
labels: ${{ steps.meta.outputs.labels }}

.vscode/tasks.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "docker build",
8+
"type": "shell",
9+
"command": "docker build -t cblauvelt/vscode-cpp .",
10+
"problemMatcher": [],
11+
"group": {
12+
"kind": "build",
13+
"isDefault": true
14+
}
15+
}
16+
]
17+
}

Dockerfile

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/cpp/.devcontainer/base.Dockerfile
2+
3+
FROM mcr.microsoft.com/vscode/devcontainers/base:0-ubuntu-20.04
4+
5+
ENV GCC_VERSION=10 \
6+
CLANG_VERSION=11 \
7+
CONAN_VERSION="1.38.0" \
8+
CONAN_PKG_VERSION="0.35.1" \
9+
CMAKE_VERSION_FULL=3.18.2 \
10+
CC=/usr/bin/gcc \
11+
CXX=/usr/bin/g++ \
12+
PYENV_ROOT=/opt/pyenv \
13+
PYTHON_VERSION=3.7.5 \
14+
PATH=/opt/pyenv/shims:${PATH} \
15+
DEBIAN_FRONTEND=noninteractive
16+
17+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
18+
19+
# hadolint ignore=DL3008
20+
RUN apt-get -qq update \
21+
&& apt-get -qq install -y --no-install-recommends --no-install-suggests \
22+
sudo \
23+
binutils \
24+
wget \
25+
git \
26+
libc6-dev \
27+
g++-${GCC_VERSION} \
28+
clang-${CLANG_VERSION} \
29+
clang-tidy \
30+
cppcheck \
31+
valgrind \
32+
gdb \
33+
libgmp-dev \
34+
libmpfr-dev \
35+
libmpc-dev \
36+
nasm \
37+
dh-autoreconf \
38+
ninja-build \
39+
libffi-dev \
40+
libssl-dev \
41+
pkg-config \
42+
subversion \
43+
zlib1g-dev \
44+
libbz2-dev \
45+
libsqlite3-dev \
46+
libreadline-dev \
47+
xz-utils \
48+
curl \
49+
libncurses5-dev \
50+
libncursesw5-dev \
51+
liblzma-dev \
52+
ca-certificates \
53+
autoconf-archive \
54+
python \
55+
pip \
56+
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 100 \
57+
&& update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-${GCC_VERSION} 100 \
58+
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \
59+
&& update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-${GCC_VERSION} 100 \
60+
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION} 100 \
61+
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 100 \
62+
&& ln -s /usr/include/locale.h /usr/include/xlocale.h \
63+
&& rm -rf /var/lib/apt/lists/* \
64+
&& curl -fL https://getcli.jfrog.io | sh \
65+
&& mv jfrog /usr/local/bin/jfrog \
66+
&& chmod +x /usr/local/bin/jfrog \
67+
&& groupadd 1001 -g 1001 \
68+
&& groupadd 2000 -g 2000 \
69+
&& groupadd 999 -g 999 \
70+
&& usermod -aG 1001,2000,999 vscode \
71+
&& pip install -q --upgrade --no-cache-dir pip==21.2.1 \
72+
&& pip install -q --no-cache-dir conan==${CONAN_VERSION} conan-package-tools==${CONAN_PKG_VERSION} cmake==${CMAKE_VERSION_FULL}
73+

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,44 @@
11
# docker-vscode-cpp
2+
23
A VSCode remote capable container that contains gcc, clang, and conan package manager
4+
5+
## Component Versions
6+
7+
| Package | Version |
8+
| ------- | ----------------------------------------- |
9+
| GCC | gcc (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0 |
10+
| Clang | clang version 11.0.0-2~ubuntu20.04.1 |
11+
| CMake | cmake version 3.18.2 |
12+
13+
## Example devcontainer file
14+
15+
Below is a sample .devcontainer file that you can use for your project. It includes an example on how to add your own conan remote.
16+
17+
```jsonc
18+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
19+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/cpp
20+
{
21+
"name": "C++",
22+
"image": "vscode-cpp",
23+
"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
24+
// Set *default* container specific settings.json values on container create.
25+
"settings": {},
26+
// Add the IDs of extensions you want installed when the container is created.
27+
"extensions": [
28+
"ms-vscode.cpptools",
29+
"ms-vscode.cpptools-extension-pack",
30+
"ms-vsliveshare.vsliveshare",
31+
"cschlosser.doxdocgen"
32+
],
33+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
34+
// "forwardPorts": [],
35+
// Mount the conan directory
36+
"mounts": ["source=conan,target=/home/vscode/.conan"],
37+
// Use 'postCreateCommand' to run commands after the container is created.
38+
// Use False if you're using a remote with a valid https cert.
39+
// --insert without a parameter places it first in the list when searching for a package
40+
"postCreateCommand": "conan remote add <remote-name> https://<ip-address>/artifactory/api/conan/conan-local False --insert",
41+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
42+
"remoteUser": "vscode"
43+
}
44+
```

0 commit comments

Comments
 (0)