Public Repository

Last pushed: 6 months ago
Short Description
How to run Spring Boot and MySql with Docker
Full Description

Description: Demo Line API (https://devdocs.line.me/en/#how-to-use-the-apis) using Spring Boot and MySQL.

How to run LineApi and MySql with Docker:
Assume you already have Docker installed. See https://docs.docker.com/installation/.

Run MySQL 5.7 in Docker container:

$ docker run --name line-mysql -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=lineId -e MYSQL_USER=congpc -e MYSQL_PASSWORD=Demo_1987 -d mysql:5.7

Check the log to make sure the server is running OK:

$ docker logs line-mysql

Run demo application in Docker container and link to line-mysql:

$ docker run -p 8080:8080 --name line-app --link line-mysql:localhost -d congpc87/line-id-api

You can check the log by

$ docker logs line-app

The docker exec command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your mysql container:

$ docker exec -it line-mysql bash

APIs:

  1. POST: http://localhost:8080/registerApi
    Body:token=[line access token], website-id=???, line-id=???, member-id=???
    Response:{"code": "200"}
  2. GET: http://localhost:8080/getApi?line-id=line123
    Response:{"member_id": "cong123", "code": "200"}
  3. POST: http://localhost:8080/deleteApi
    Body:token=[line access token], website-id=???, member-id=???
    Response:{"code": "200"}
Docker Pull Command
Owner
congpc87

Comments (0)