Skip to content

bondhan/ecommerce

Repository files navigation

ecommerce

A simple E2E ecommerce REST api. For GOTOKO take home test. Author: bondhan.novandy@gmail.com

build & run

make

migration

create migration

migrate create -ext sql -dir migrations/scripts/ -seq -digits 2 create_table_order_details

migrate up

migrate -database mysql://root@/ecommerce -path ./migrations/scripts up

migrate down

migrate -database mysql://root@/ecommerce -path ./migrations/scripts down

run docker

mac:

docker run -e API_URL=http://host.docker.internal:3030 -e "MYSQL_HOST=localhost" -e "MYSQL_PORT=3306" -e "MYSQL_USER=root" -e "MYSQL_DBNAME=ecommerce" -p 8080:3030 ecommerce:v1
 docker run -e "MYSQL_HOST=host.docker.internal" -e "MYSQL_PORT=3306" -e "MYSQL_USER=root" -e "MYSQL_DBNAME=ecommerce" -p 8080:3030 ecommerce:v1

linux:

docker build --platform linux/amd64  --no-cache -t bono02/ecommerce:v1-linux -f ./Dockerfile .

interactive:

docker run --rm -ti -e "MYSQL_HOST=host.docker.internal" -e "MYSQL_PORT=3306" -e "MYSQL_USER=root" -e "MYSQL_DBNAME=ecommerce" -p 8080:3030 ecommerce:v1 /bin/bash

push:

docker build --platform linux/amd64  --no-cache -t bono02/ecommerce:v1-linux -f ./Dockerfile .  &&  docker push bono02/ecommerce:v1-linux

Result

HWY717