todo/repositories.go package todo import ( "errors" "/jinzhu/gorm" ) type TodoRepository struct Let's include that by creating a new file called. The Dockerfile already accounts for that, but we still need to include the air config. We are going to be using air to allow hot-reloads on dev/debug mode. In this step, we basically copy all the code, install the dependencies and compile the app.Īnd last but not least, from lines 34 to 39 we set up our prod config, where we pull the compiled code from the builder stage, expose the port 5000 and set up the entry point for this compiled app. Next from lines 25 to 32 we create a builder stage, which is used to create a compiled application for a production run. Line 23 we have the entry point for the dev stage, which basically runs air Lines 20 and 21 we expose the main port 5000 and the debug port 2345.Line 19 we install air, which will be used for hot-reloading.Line 16 we create a dev stage based on the base stage.Lines 8 to 14 are used to update local dependencies and install ca-certificates (important if you aim to use SSL/TLS). CGO_ENABLED=0 allows the program to build without anyĮxternal dependencies, using a statically-linked binary.GOOS=linux tells the compiler for which OS it needs to.GO111MODULE=on Forces go to use modules even if the project is in the GOPATH.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |