goAnonPicDB is a simple web service that allows users to anonymously upload images. It is built with Go and uses GORM
as the ORM (Object-Relational Mapping) library. The images are stored in a MySQL database. It might be a good example for learning how to organize applications with docker
and docker-compose
.
User interface (web)
Database managing uploaded pictures via filepath (real image data are uploaded to /static
)
- Anonymous image uploading via HTTP communication
- Display of the 6 most recent images (number may be adjusted by user. Go to
main.go
) - Count of total uploaded images
- Docker support for easy deployment (via
docker-compose.yaml
)
-
Clone the repository:
git clone https://github.com/KnightChaser/goAnonPicDB.git cd goAnonPicDB
-
(optional) Modify
.env
for preconfigured environmental variables (will be applied todocker-compose.yaml
).MYSQL_ROOT_PASSWORD=root # (not used in this service actually) MYSQL_DATABASE_NAME=images # The name of database where image filepath is stored MYSQL_USERNAME=knightchaser # The username of database (actually used) MYSQL_PASSWORD=goanonpicdb # The password of database (actually used)
-
Build and run the Docker containers:
docker-compose up -d
-
Access the application at http://localhost:8080 in your web browser. And you'll see the web implementation of
goAnonPicDB
!
- Dockerize applications
- Create
.env
file and manage cross-service environmental variables and constants (Or do the same thing with other methods) - Complete GitHub CI/CD Integration with GitHub Action for automatic Docker deployment. DockerHub release will be visible at
knightchaser/goanonpicdb
Contributions are welcome! Please feel free to submit issues or pull requests.