feat: describe debuging with docker
This commit is contained in:
parent
5f88b64cbe
commit
7b75541300
@ -1,5 +1,5 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="remote docker debug" type="GoRemoteDebugConfigurationType" factoryName="Go Remote" port="4040">
|
<configuration default="false" name="debug remote docker container" type="GoRemoteDebugConfigurationType" factoryName="Go Remote" port="4040">
|
||||||
<option name="disconnectOption" value="ASK" />
|
<option name="disconnectOption" value="ASK" />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
31
README.md
31
README.md
@ -1,24 +1,43 @@
|
|||||||
|
# Standard Go Project Template
|
||||||
|
This is a template for Go application projects based on [Standard Go Project Layout](https://github.com/golang-standards/project-layout).
|
||||||
|
|
||||||
|
### Build, run and debug application locally
|
||||||
|
|
||||||
|
### Build, run and debug application with docker
|
||||||
|
|
||||||
|
#### Create environment file for docker
|
||||||
|
Create and fill environment file from template `.env.dist`
|
||||||
|
``` shell
|
||||||
|
cp .env.dist .env.docker
|
||||||
|
```
|
||||||
|
|
||||||
#### Build docker container
|
#### Build docker container
|
||||||
Build container
|
Build container
|
||||||
```bash
|
``` shell
|
||||||
docker build . -t psssix/golang-app:latest
|
docker build . -t psssix/golang-app:latest
|
||||||
```
|
```
|
||||||
and container with debugger
|
and container with debugger
|
||||||
```bash
|
``` shell
|
||||||
docker build . -f Debug.Dockerfile -t psssix/golang-app:debug
|
docker build . -f Debug.Dockerfile -t psssix/golang-app:debug
|
||||||
```
|
```
|
||||||
|
|
||||||
Push container
|
Push container
|
||||||
```bash
|
``` shell
|
||||||
docker push psssix/golang-app:latest
|
docker push psssix/golang-app:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Run docker container
|
#### Run docker container
|
||||||
Run container on docker
|
Run container on docker
|
||||||
```bash
|
``` shell
|
||||||
docker run -d --name golang-app --env-file .env.docker psssix/golang-app:latest
|
docker run -d --name golang-app --env-file .env.docker psssix/golang-app:latest
|
||||||
```
|
```
|
||||||
and container with debugger
|
and container with debugger
|
||||||
```bash
|
``` shell
|
||||||
docker run -d --name golang-app --security-opt="apparmor=unconfined" --cap-add=SYS_PTRACE -p 4040:4040 --env-file .env.docker psssix/golang-app:debug
|
docker run -d --name golang-app --security-opt="apparmor=unconfined" --cap-add=SYS_PTRACE -p 4040:4040 --env-file .env.docker psssix/golang-app:debug
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Debug docker container
|
||||||
|
1. Create and fill `.env.docker` file by template `.env.dist`.
|
||||||
|
2. Build docker container with debugger.
|
||||||
|
3. Run container on docker with debugger.
|
||||||
|
4. Play debug configuration names as "debug remote docker container".
|
||||||
Loading…
x
Reference in New Issue
Block a user