{"id":13796789,"url":"https://github.com/ilourt/gocker","last_synced_at":"2025-05-13T00:31:06.863Z","repository":{"id":67968746,"uuid":"93302580","full_name":"ilourt/gocker","owner":"ilourt","description":"A starter project using docker and golang","archived":false,"fork":false,"pushed_at":"2019-10-29T11:47:37.000Z","size":591,"stargazers_count":88,"open_issues_count":0,"forks_count":12,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-02-14T22:36:01.462Z","etag":null,"topics":["delve","deps","docker","golang"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ilourt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-04T09:16:17.000Z","updated_at":"2024-08-03T23:07:21.013Z","dependencies_parsed_at":null,"dependency_job_id":"2a88e9c2-d114-48cf-a08e-1c2d6b1760be","html_url":"https://github.com/ilourt/gocker","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilourt%2Fgocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilourt%2Fgocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilourt%2Fgocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilourt%2Fgocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilourt","download_url":"https://codeload.github.com/ilourt/gocker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225159879,"owners_count":17430203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["delve","deps","docker","golang"],"created_at":"2024-08-03T23:01:15.243Z","updated_at":"2024-11-18T10:31:38.275Z","avatar_url":"https://github.com/ilourt.png","language":"Shell","funding_links":[],"categories":["Containers"],"sub_categories":[],"readme":"# Gocker\n\nGocker is a starter project using docker and golang with automatic rebuild in development mode.\n\n*PROJECT NOT MAINTAINED*\n\n\n## Getting started\n\n### Prerequisites\n\nIn order to run this project you need to have Docker \u003e 1.17.05 installed for building the production image.\n\n### Installing\nTo use this to start your golang project, simply do:\n```sh\n$\u003e git clone https://github.com/ilourt/gocker\n```\n\nThen feel free to add other docker services in the **docker-compose.yml**  files to suit the needs of your app.\n\n#### Development\n\n```sh\n$\u003e docker-compose up\n```\n\nIt is possible to disable automatic rebuild in development. In order to do this simply change the value of **WATCH** to anything different than true in the **.env** file. In this case you will have to relaunch `$\u003e docker-compose up` each time you want to rebuild.\n\u003e In case of development of **server** (like an http server) replace in *modd.conf* \"prep: go run ./*.go\" by :\n  ```\n  prep: go build -o $BIN_NAME ./*.go \n  daemon: ./$BIN_NAME\n  ```\n\nTo create binary set the **BUILD** to **true** in the env file. The binary name can be customized by setting the **BIN_NAME** variable.\n\nFor dependencies management [dep](https://github.com/golang/dep) is used. Be carefful, it is now in alpha mode but must become the future official tool to manage dependencies. If you prefer you can disable it by setting the value od **GO_DEP** to false in the *.env** file.\n\nIn the Dockerfile, there is the creation of a user to create file on the disk as non root user. By default the user is *ilourt* with a UID of *1000*. You can change these values in **.env** file.\n\n\u003e To know the uid of your current user use the following command:`$\u003e id `\n\n##### Debugging\n\nIt is possible to use **delve** to debug the project. In order to use it:\n* set the **DEBUG** variable to **true**\n* install delve on the host\n* connect delve on the host to the delve headless server running in the container\n  ```sh\n  $\u003e dlv connect localhost:2345\n  ```\n  the port can be customized in **modd-debug.conf**. If you modify the port don't forget to update the **docker-compose.yml**.\n\n#### Production\n\n```sh\n$\u003e docker build -t gocker-prod:latest -f ./Dockerfile.prod .\n$\u003e docker run gocker-prod:latest\n```\n\nWith the hello world example, the size of the production docker image is 5.52MB.\n\n### File structure\n\nThe folder **go** is a volume which represents the go folder of the docker image. It allows to use code autocompletion in your favorite IDE.\n\u003e With atom you could use the package [atomenv](https://atom.io/packages/atomenv) to specify the $GOPATH on a project basis\n\nThe folder **go/src/app** corresponds to the folder containing the source code of your app. It the folder which will be automatically rerun. At the root of this folder there is a file **start.sh**. It is the script run when the docker image start, it allows to download and install dependencies and then to run the project.\n\n\n## Built With\n\n* [Docker](https://docker.com) - The linux container\n* [Docker compose](https://docs.docker.com/compose/) - Util used to manage docker images\n* [Golang](https://golang.org) - Language for which this project is used\n\n## Author\n\n**Irwin Lourtet** [https://github.com/ilourt](https://github.com/ilourt)  (\u003cdev@ilourt.com\u003e)\n\nThanks to people on [reddit](https://redd.it/6f6lil) who helps me improve it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filourt%2Fgocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filourt%2Fgocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filourt%2Fgocker/lists"}