gin-rest-api-example icon indicating copy to clipboard operation
gin-rest-api-example copied to clipboard

Fix Docker build failure and configuration issues

Open ansh0014 opened this issue 9 months ago • 1 comments

  • Update Dockerfile from Go 1.14 to Go 1.21-alpine
  • Implement multi-stage build for smaller image size
  • Add MySQL root password in docker-compose.yaml
  • Fix article-server command path (article-server -> ./article-server)
  • Add proper volume mount for config file (local.yaml -> config.yaml)
  • Add depends_on to ensure MySQL starts before article-server
  • Include build context and dockerfile specification

These changes resolve Docker build failures and runtime configuration errors."

ansh0014 avatar Feb 10 '26 09:02 ansh0014

Problem

  • Docker build failed due to outdated Go version (1.14)
  • Missing MySQL credentials in docker-compose
  • Incorrect article-server command path
  • Missing volume mounts for config and migrations

Solution

  • Updated Dockerfile to use golang:1.21-alpine
  • Added MySQL environment variables to docker-compose
  • Fixed article-server command path
  • Added volume mounts for config and migration files
  • Added depends_on to ensure correct startup order

Testing

  • Docker build completed successfully
  • All containers running as expected
  • Article server accessible on port 8080
  • MySQL connection verified #Issue No. [#2]

ansh0014 avatar Feb 10 '26 09:02 ansh0014