71 lines
1.7 KiB
Markdown
71 lines
1.7 KiB
Markdown
|
|
||
|
# wrappd.sh
|
||
|
|
||
|
Wrapped tool for the guys living in a b&w world.
|
||
|
|
||
|
## Config
|
||
|
|
||
|
Copy the `env.sample` in `.env` and set up the variables:
|
||
|
|
||
|
```sh
|
||
|
$ cp env.sample .env
|
||
|
```
|
||
|
|
||
|
```ini
|
||
|
# Docker
|
||
|
DOCKER_ENV=production
|
||
|
PROJECT_NAME=heating-monitor
|
||
|
FIXME
|
||
|
```
|
||
|
|
||
|
## Docker
|
||
|
|
||
|
This project can be easily run on Docker:
|
||
|
|
||
|
```sh
|
||
|
$ make build
|
||
|
$ make rebuild
|
||
|
$ make start
|
||
|
```
|
||
|
|
||
|
The `Makefile` has been configured to facilitate the build and execution of Docker with the `--build-arg` argument, which passes the `DOCKER_ENV` environment variable to determine the environment. This variable is read from the .env file:
|
||
|
|
||
|
`--build-arg DOCKER_ENV=${DOCKER_ENV}`: This variable is used to determine the execution environment (`local` or `production`), affecting both the binary build process and the container's behavior.
|
||
|
|
||
|
If `DOCKER_ENV` is set to `production` it should execute the binary, whereas if set to `local` it will run with air to enable reloads during development, among other things.
|
||
|
|
||
|
## Comands
|
||
|
|
||
|
```bash
|
||
|
$ go run cmd/web/main.go
|
||
|
```
|
||
|
|
||
|
## Dependencies
|
||
|
|
||
|
Ensure your dependencies are installed:
|
||
|
|
||
|
```sh
|
||
|
$ go mod tidy
|
||
|
```
|
||
|
|
||
|
## Skel project
|
||
|
|
||
|
```sh
|
||
|
.
|
||
|
├── cmd/
|
||
|
│ ├── web/ # Command for the web to init
|
||
|
├── internal/
|
||
|
│ ├── web/ # Web logic (routes, controller...)
|
||
|
├── result/ # Place for storing the results
|
||
|
├── upload/ # Temporal place for storing the uploads (inmediately removed)
|
||
|
├── .env.sample # Sample environment file
|
||
|
└── README.md # This file
|
||
|
└── Dockerfile # Requirement for the docker container to be built
|
||
|
└── docker-compose.yml # Docker orchestration file
|
||
|
└── Makefile # Helper for the project to be run/build/stop...
|
||
|
```
|
||
|
|
||
|
## Contribs
|
||
|
|
||
|
TBD
|