Skip to content

Commit

Permalink
feat: add debian docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Sep 18, 2021
1 parent 144817e commit 8f9841a
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 28 deletions.
53 changes: 28 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,47 +40,50 @@ Tip: You can automate downloading using `wget`, `curl` or other similar tools.

### Executable

Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v0.1.1), and run it with the available options.
Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v0.2), and run it with the available options.

An example that installs llvm, cmake, ninja, ccache, and conan.
An example that installs llvm, cmake, ninja, ccache, and conan:

```ps1
# windows example (open shell as admin)
curl -O "https://github.com/aminya/setup-cpp/releases/download/v0.1.1/setup_cpp_windows.exe"
./setup_cpp_windows --compiler llvm --cmake true --ninja true --ccache true --conan "1.40.1"
curl -O "https://github.com/aminya/setup-cpp/releases/download/v0.2/setup_cpp_windows.exe"
./setup_cpp_windows --compiler llvm --cmake true --ninja true --ccache true --conan true
```

```ps1
# linux example
wget "https://github.com/aminya/setup-cpp/releases/download/v0.1.1/setup_cpp_linux"
wget "https://github.com/aminya/setup-cpp/releases/download/v0.2/setup_cpp_linux"
chmod +x setup_cpp_linux
sudo ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --conan "1.40.1"
sudo ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --conan true
```

```ps1
# mac example
wget "https://github.com/aminya/setup-cpp/releases/download/v0.1.1/setup_mac_linux"
wget "https://github.com/aminya/setup-cpp/releases/download/v0.2/setup_mac_linux"
chmod +x setup_cpp_mac
sudo ./setup_cpp_mac --compiler llvm --cmake true --ninja true --ccache true --conan "1.40.1"
sudo ./setup_cpp_mac --compiler llvm --cmake true --ninja true --ccache true --conan true
```

NOTE: In the `compiler` entry, you can specify the version after `-` like `llvm-11`.
For the tools, instead of `true`, which chooses the default version, you can pass a specific version.

### With Nodejs

Download the `setup_cpp.js` file form [here](https://github.com/aminya/setup-cpp/releases/download/v0.1.1/setup_cpp.js), and run it with the available options.
Download the `setup_cpp.js` file form [here](https://github.com/aminya/setup-cpp/releases/download/v0.2/setup_cpp.js), and run it with the available options.

On Windows

```ps1
# open shell as admin
wget "https://github.com/aminya/setup-cpp/releases/download/v0.1.1/setup_cpp_windows.exe"
node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --conan "1.40.1"
wget "https://github.com/aminya/setup-cpp/releases/download/v0.2/setup_cpp_windows.exe"
node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --conan true
```

On Linux or Mac:

```ps1
wget "https://github.com/aminya/setup-cpp/releases/download/v0.1.1/setup_cpp.js"
sudo node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --conan "1.40.1"
wget "https://github.com/aminya/setup-cpp/releases/download/v0.2/setup_cpp.js"
sudo node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --conan true
```

# Inside GitHub Actions
Expand Down Expand Up @@ -111,6 +114,7 @@ jobs:
compiler:
- llvm
- gcc
# you can specify the version after `-` like `llvm-11`.
steps:
- name: Setup Cpp
uses: aminya/setup-cpp@v1
Expand All @@ -120,40 +124,39 @@ jobs:
ninja: true
conan: true
cppcheck: true
ccache: true
ccache: true # instead of `true`, which chooses the default version, you can pass a specific version.
# add any tool that you need here...
```

In the `compiler` entry, you can specify the version after a `-`. For example, `llvm-11`.

For the tools, instead of `true`, which chooses the default version, you can pass a specific version.

# Inside Docker

Here is an example for using setup_cpp to make a builder image that has the cpp tools you need.

```dockerfile
# debian with node installed
FROM node:16
# debian
FROM debian:bullseye

# add setup_cpp.js
# add setup_cpp
WORKDIR "/"
RUN wget "https://github.com/aminya/setup-cpp/releases/download/v0.1.1/setup_cpp.js"
RUN wget "https://github.com/aminya/setup-cpp/releases/download/v0.2/setup_cpp_linux"
RUN chmod +x ./setup_cpp_linux

# install llvm, cmake, ninja, ccache, and conan
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --conan true
RUN ./setup_cpp --compiler llvm --cmake true --ninja true --ccache true --conan true

ENTRYPOINT [ "/bin/bash" ]
```

See [this folder](https://github.com/aminya/setup-cpp/tree/master/building/docker), for some dockerfile examples.

If you want to build the ones included, then run (after `-f` use the docker file name):
If you want to build the ones included, then run:

```ps1
docker build -f ./building/docker/linux.dockerfile -t setup_cpp .
docker build -f ./building/docker/debian.dockerfile -t setup_cpp .
```

After `-f` use the docker file name.

### Incomplete

- [ ] msvc. It is implemented, but has bugs. See [this issue](https://github.com/aminya/cpp/issues/1)
Expand Down
12 changes: 12 additions & 0 deletions building/docker/debian.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# debian
FROM debian:bullseye

# add setup_cpp
WORKDIR "/"
RUN wget "https://github.com/aminya/setup-cpp/releases/download/v0.2/setup_cpp_linux"
RUN chmod +x ./setup_cpp_linux

# install llvm, cmake, ninja, ccache, and conan
RUN ./setup_cpp --compiler llvm --cmake true --ninja true --ccache true --conan true

ENTRYPOINT [ "/bin/bash" ]
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dist/setup_cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"test.unit": "jest --runInBand",
"test": "run-p test.format test.lint test.tsc test.unit",
"pack.exe": "shx rm -rf ./dist/tsconfig.tsbuildinfo && node ./building/scripts/pack-exe.js",
"build.docker": "pnpm build && docker build -f ./building/docker/linux.dockerfile -t setup_cpp .",
"build.docker": "pnpm build && docker build -f ./building/docker/debian.dockerfile -t setup_cpp .",
"start.docker": "docker run -t setup_cpp ."
},
"engines": {
Expand Down

0 comments on commit 8f9841a

Please sign in to comment.