You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Install `gcc`, `cmake`, `git`, and `pthread` (Skip this step if you already install)
34
-
```
35
-
$ sudo apt-get update
36
-
$ sudo apt-get install g++
37
-
$ sudo apt-get install lcov
38
-
$ sudo apt-get install cmake
39
-
$ sudo apt-get install git
40
-
$ sudo apt-get install cppcheck
41
-
```
42
-
* Build the application and the tests
43
-
```
44
-
$ cd build
45
-
$ cmake ..
46
-
$ cmake --build .
47
-
```
48
-
* Run the application and the test
49
-
```
50
-
$ ./cpp_lab_project
51
-
$ ./cpp_lab_project_test
52
-
```
53
-
* (Optional) Run static analysis
54
-
```
55
-
$ sudo apt-get install cppcheck
56
-
$ cppcheck "folder" / "file"
57
-
```
58
-
* 2.Using **Docker**
59
-
* Build the Docker image
60
-
```
61
-
docker build --tag sample-ci-cpp .
62
-
```
63
-
* Run an interactive container
64
-
```
65
-
docker run -it sample-ci-cpp:latest /bin/bash
66
-
```
67
-
* Inspect the environment
68
-
```
69
-
printenv
70
-
```
71
-
**Notes:*
72
-
* Use the -t or --tag flag to set the name of the image to be created. (the full name is actually sample-ci-cpp:latest, since latest is the default tag)
73
-
* Opening an interactive shell inside your Docker container to explore, test, or debug the environment built from your image.
74
-
* docker run to start a new container.
75
-
* -it → run it interactively:
76
-
* -i = keep STDIN open (so you can type commands)
77
-
* -t = allocate a terminal (TTY)
78
-
* sample-ci-cpp:latest → the image you built earlier.
79
-
* /bin/bash → the command to execute inside the container (opens a Bash shell).
30
+
## 3. Setup
31
+
### 3.1. Setup the Local Test Environment
32
+
- **Ubuntu system**
33
+
* Install `gcc`, `cmake`, `git`, and `pthread` (Skip this step if you already install)
* Use the `-t` or `--tag` flag to set the name of the image to be created. (the full name is actually `cpp-lab:latest`, since latest is the default tag)
80
+
* Opening an interactive shell inside your Docker container to explore, test, or debug the environment built from your image.
81
+
* docker run to start a new container.
82
+
*`-it`: run it interactively:
83
+
*`-i`: keep STDIN open (so you can type commands)
84
+
*`-t`: allocate a terminal (TTY)
85
+
*`cpp-lab:latest`: the image you built earlier.
86
+
*`/bin/bash`: the command to execute inside the container (opens a Bash shell).
80
87
81
-
## 4. DOCUMENTATIONS
88
+
## 5. Update Docker Image
89
+
```bash
90
+
# Navigate to the project that contain your Dockerfile
91
+
cd cpp-lab
92
+
93
+
# Build the project by running the following command, swapping out DOCKER_USERNAME with your username.
94
+
docker build -t DOCKER_USERNAME/cpp-lab .
95
+
96
+
# Verify the image exists locally
97
+
docker image ls
98
+
99
+
# To push the image
100
+
docker push DOCKER_USERNAME/cpp-lab
101
+
```
102
+
103
+
## 6. TROUBLESHOOTING
104
+
1. `push access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed`
0 commit comments