- Go >= 1.19.2
# build cross platform
$ CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app cmd/main.go
# Database
$ docker run --name mysql --privileged=true \
-e MYSQL_ROOT_PASSWORD="1234" \
-e MYSQL_USER="helmet_shop" \
-e MYSQL_PASSWORD="1234" \
-e MYSQL_DATABASE="helmet_shop" \
-p 3306:3306 bitnami/mysql:5.7
#docker build
$ docker build -t helmet-shop-image
# create a network
$ docker network create helmet-shop
# docker network connect
$ docker network connect helmet-shop mysql
# run
$ docker run -d --name helmet-shop \
-e MYSQL_URI="helmet_shop:1234@tcp(mysql:3306)/helmet_shop?charset=utf8mb4&parseTime=True&loc=Local" \
--network=fd-delivery \
-p 3001:8080 \
helmet-shop-image
≈Install 🐳🐳 DOCKER 🐳🐳 Engine on Ubuntu≈
Reference
$ sudo apt-get update
$ sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
$ sudo mkdir -p /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
$ docker run -d -p 80:80 -p 443:443 \
--network=helmet-shop --name nginx-proxy \
-e ENABLE_IPV6=true \
--privileged=true \
-v ~/nginx/vhost.d:/etc/nginx/vhost.d \
-v ~/nginx-certs:/etc/nginx/certs:ro \
-v ~/nginx-conf:/etc/nginx/conf.d \
-v ~/nginx-logs:/var/log/nginx \
-v /usr/share/nginx/html \
-v /var/run/docker.sock:/tmp/docker.socker:ro \
--label nginx_proxy jwilder/nginx-proxy
$ docker run -d --network=helmet-shop \
-v ~/nginx/vhost.d:/etc/nginx/vhost.d \
-v ~/nginx-certs:/etc/nginx/certs:rw \
-v /var/run/docker.sock:/tmp/docker.socker:ro \
--volumes-from nginx-proxy \
--privileged=true \
jrcs/letsencrypt-nginx-proxy-companion
👤 Huynh Minh Quang
- Github: @orgball2608