Skip to content

Latest commit

 

History

History
executable file
·
66 lines (48 loc) · 1.77 KB

README.md

File metadata and controls

executable file
·
66 lines (48 loc) · 1.77 KB

Getting Started

Download ZIP from Github

go run main.go

Build app image

docker build -t golang-app .
docker build --no-cache -t alexchub/golang-app:latest .
docker push alexchub/golang-app:latest
docker image rmi alexchub/golang-app:latest

Run App docker container

docker run -d -p 8000:8000 --name app -e MYSQL_URL="phones:ZPwg4wHh@tcp(172.17.0.2:3306)/phones" -e JWT_KEY=VQBbmC9g -v /app/photo:/app/public/photo alexchub/golang-app:latest

Environment variables

MYSQL_URL

MariaDB image into docker hub

docker pull mariadb:10.4
docker tag mariadb:10.4 alexchub/mariadb:10.4
docker push alexchub/mariadb:10.4

Run MariaDB docker container

docker run -d -p 3306:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=ZPwg4wHh -e MYSQL_DATABASE=phones -e MYSQL_USER=phones -e MYSQL_PASSWORD=ZPwg4wHh -v /app/mysql:/var/lib/mysql mariadb:10.4

Check ip address

docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb

Connect to MariaDB server

mysql -h 172.17.0.2 -u phones -P 3306 -p

Create database structure

mysql -h 172.17.0.2 -u phones -p phones < ~/Downloads/Github/phones_api_golang/struct.sql

Licensing

App is MIT licensed.