mirror of
https://github.com/PretendoNetwork/pikmin-3.git
synced 2026-04-25 15:42:37 -05:00
Merge pull request #1 from PretendoNetwork/docker
This commit is contained in:
commit
b8be11bedf
7
.dockerignore
Normal file
7
.dockerignore
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
.env
|
||||
.git
|
||||
build
|
||||
log
|
||||
go.work
|
||||
*.test
|
||||
go.work.sum
|
||||
19
Dockerfile
Normal file
19
Dockerfile
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# --- builder ---
|
||||
FROM golang:1.20.6-alpine3.17 as builder
|
||||
LABEL stage=builder
|
||||
RUN apk add git
|
||||
WORKDIR /build
|
||||
|
||||
COPY go.* ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . ./
|
||||
ARG BUILD_STRING=pretendo.pikmin3.docker
|
||||
RUN go build -ldflags "-X 'main.serverBuildString=${BUILD_STRING}'" -v -o server
|
||||
|
||||
# --- runner ---
|
||||
FROM alpine:3.17 as runner
|
||||
WORKDIR /build
|
||||
|
||||
COPY --from=builder /build/server /build/
|
||||
CMD ["/build/server"]
|
||||
27
README.md
27
README.md
|
|
@ -11,6 +11,33 @@ $ 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.
|
||||
|
||||
Once installed, execute the following to build:
|
||||
|
||||
```bash
|
||||
$ docker build -t pikmin3 --build-arg BUILD_STRING=YOUR_BUILD_STRING_HERE .
|
||||
$ docker image prune --filter label=stage=builder -f
|
||||
```
|
||||
Note: `--build-arg` flag/variable is optional.
|
||||
|
||||
Create a `.env` file with all of the necessary environment variables set. The variable list is available below.
|
||||
|
||||
Example:
|
||||
```
|
||||
PN_PIKMIN3_POSTGRES_URI=postgres://username:password@localhost/pikmin3?sslmode=disable
|
||||
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
|
||||
```
|
||||
|
||||
Other tools and systems can also make use of this image, including 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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user