Running `go mod download` before copying the entire project to the
Docker image avoids dependencies from being re-downloaded every time any
file is modified, and `docker build` runs again.
This follows the steps detailed in the official Docker guide for Go
images:
https://docs.docker.com/language/golang/build-images/#create-a-dockerfile-for-the-application
Also, `GO111MODULE` doesn't make any difference for the supported
Go versions, so it can be removed from the Dockerfile.
* Add charset to content type in getHandler
Add charset to content type in the getHandler function to fix CJK-letter related issues.
If the content type is empty after trimming, set it to "text/plain; charset=utf-8".
* Add mailcap and mime.types to transfer.sh container
This commit includes /etc/mime.types file to the container, which is necessary to properly select the charset using MIME typing during file upload.
For more information, read https://github.com/dutchcoders/transfer.sh/pull/545#issuecomment-1528712181
---------
Co-authored-by: Andrea Spacca <andrea.spacca@gmail.com>
Use Go 1.20 by default in Dockerfile
Updating the default Go version used in the Dockerfile, to the latest
one supported by the project at the moment.
Also, Go `1.17` support was removed in
9f1fe62e05
This drastically decreases the overall image size. Quick comparison:
```
# Image fetched from Docker Hub
dutchcoders/transfer.sh latest a875ed5dfa56 5 months ago 704MB
# Image just built
dutchcoders/transfer.sh latest a220c49297eb 4 minutes ago 269MB
```