mirror of
https://github.com/PretendoNetwork/pikmin-3.git
synced 2026-04-26 00:26:23 -05:00
Added docker rule to Makefile
This commit is contained in:
parent
4a03a1b741
commit
ed930439f5
10
Makefile
10
Makefile
|
|
@ -44,17 +44,21 @@ SERVER_BUILD := $(BRANCH):$(REMOTE_PATH)@$(HASH)
|
|||
else
|
||||
# * .git folder not present, assume downloaded from zip file and just use folder name
|
||||
$(info "$(CYAN)git repository not found. Building server build string from folder name$(RESET)")
|
||||
SERVER_BUILD := $(notdir $(CURDIR))
|
||||
SERVER_BUILD := pikmin-3
|
||||
endif
|
||||
|
||||
# * Final build string
|
||||
DATE_TIME := $(shell date --iso=seconds)
|
||||
BUILD_STRING := $(SERVER_BUILD), $(DATE_TIME)
|
||||
|
||||
all:
|
||||
default:
|
||||
ifeq ($(wildcard .env),)
|
||||
$(warning "$(YELLOW).env file not found, environment variables may not be populated correctly$(RESET)")
|
||||
endif
|
||||
go get -u
|
||||
go mod tidy
|
||||
go build -ldflags "-X 'main.serverBuildString=$(BUILD_STRING)'" -o ./build/$(notdir $(CURDIR))
|
||||
go build -ldflags "-X 'main.serverBuildString=$(BUILD_STRING)'" -o ./build/pikmin-3
|
||||
|
||||
docker:
|
||||
docker build -t pikmin-3 --build-arg BUILD_STRING="$(BUILD_STRING)" .
|
||||
docker image prune --filter label=stage=builder -f
|
||||
43
README.md
43
README.md
|
|
@ -11,18 +11,24 @@ $ git clone https://github.com/PretendoNetwork/pikmin-3
|
|||
$ cd pikmin-3
|
||||
```
|
||||
|
||||
### Compiling and running using `docker` (PREFERRED)
|
||||
Make sure you have Docker installed on your system. This can be done using various instructions available online.
|
||||
### Compiling and running using `docker` (Preferred)
|
||||
Install Docker either through your systems package manager or the [official installer](https://docs.docker.com/get-docker/)
|
||||
|
||||
Once installed, execute the following to build:
|
||||
To build the container:
|
||||
|
||||
```bash
|
||||
$ docker build -t pikmin3 --build-arg BUILD_STRING=YOUR_BUILD_STRING_HERE .
|
||||
$ docker build -t pikmin-3 .
|
||||
$ docker image prune --filter label=stage=builder -f
|
||||
```
|
||||
Note: `--build-arg` flag/variable is optional.
|
||||
Optionally you may provide `BUILD_STRING` to `--build-arg` to set the authentication server build string
|
||||
|
||||
Create a `.env` file with all of the necessary environment variables set. The variable list is available below.
|
||||
```bash
|
||||
$ docker build -t pikmin3 --build-arg BUILD_STRING=auth-build-string .
|
||||
$ docker image prune --filter label=stage=builder -f
|
||||
```
|
||||
If `BUILD_STRING` is not set, the default build string `pretendo.pikmin3.docker` is used. You may also use the `docker` rule when building with `make` to set the build string automatically. See [compiling using `make`](#compiling-using-make) below for more info
|
||||
|
||||
To run the image first create a `.env` file with your [Configuration](#configuration) set before using `docker run`
|
||||
|
||||
Example:
|
||||
```
|
||||
|
|
@ -31,12 +37,11 @@ PN_PIKMIN3_AUTHENTICATION_SERVER_PORT=61001
|
|||
...
|
||||
```
|
||||
|
||||
Then, you can use the following command to run the image.
|
||||
```bash
|
||||
$ docker run --name pikmin3 --env-file .env -it pikmin3
|
||||
$ docker run --name pikmin-3 --env-file .env -it pikmin-3
|
||||
```
|
||||
|
||||
Other tools and systems can also make use of this image, including Docker Compose and Portainer.
|
||||
The image is compatible popular container managers such as Docker Compose and Portainer
|
||||
|
||||
### Compiling using `go`
|
||||
To compile using Go, `go get` the required modules and then `go build` to your desired location. You may also want to tidy the go modules, though this is optional
|
||||
|
|
@ -44,25 +49,35 @@ To compile using Go, `go get` the required modules and then `go build` to your d
|
|||
```bash
|
||||
$ go get -u
|
||||
$ go mod tidy
|
||||
$ go build -o build/pikmin3
|
||||
$ go build -o build/pikmin-3
|
||||
```
|
||||
|
||||
The server is now built to `build/pikmin3`
|
||||
The server is now built to `build/pikmin-3`
|
||||
|
||||
When compiling with only Go, the authentication servers build string is not automatically set. This should not cause any issues with gameplay, but it means that the server build will not be visible in any packet dumps or logs a title may produce
|
||||
|
||||
To compile the servers with the authentication server build string, add `-ldflags "-X 'main.serverBuildString=BUILD_STRING_HERE'"` to the build command, or use `make` to compile the server
|
||||
|
||||
### Compiling using `make`
|
||||
Compiling using `make` will read the local `.git` directory to create a dynamic authentication server build string, based on your repositories remote origin and current commit. It will also use the current folders name as the executables name
|
||||
Compiling using `make` will read the local `.git` directory to create a dynamic authentication server build string, based on your repositories remote origin and current commit
|
||||
|
||||
Install `make` onto your system (this varies by OS), and run `make` while inside the repository
|
||||
Install `make` either through your systems package manager or the [official download](https://www.gnu.org/software/make/). We provide two different rules; A `default` rule which compiles [using `go`](#compiling-using-go), and a `docker` rule which compiles [using `docker`](#compiling-and-running-using-docker-preferred). Please refer to each sections setup instructions before continuing with your preferred rule
|
||||
|
||||
To build using `go`
|
||||
|
||||
```bash
|
||||
$ make
|
||||
```
|
||||
|
||||
The server is now built to `build/pikmin-3` with the authentication server build string already set
|
||||
The server is now built to `build/pikmin-3`
|
||||
|
||||
To build using `docker`
|
||||
|
||||
```bash
|
||||
$ make docker
|
||||
```
|
||||
|
||||
The image is now ready to run
|
||||
|
||||
## Configuration
|
||||
All configuration options are handled via environment variables
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user