Skip to content

Commit

Permalink
add docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
Aldiwildan77 committed Jul 7, 2021
1 parent 3986de5 commit f3d1ad8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM golang:alpine3.13 as builder

RUN apk update && apk upgrade && \
apk --no-cache --update add git make

WORKDIR /go/src/github.com/Aldiwildan77/rust-updater

COPY . .

RUN go mod download && \
go build -v -o engine && \
chmod +x engine

## Distribution
FROM alpine:latest

RUN apk update && apk upgrade && \
apk --no-cache --update add ca-certificates tzdata && \
mkdir /app && mkdir rust-updater

WORKDIR /rust-updater

EXPOSE 8000

COPY --from=builder /go/src/github.com/Aldiwildan77/rust-updater/engine /app

CMD /app/engine
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
This repository is for update notifications from the rust game which helps server admins to get official game updates

## How to build
### Native build:
1. Please check your current OS and Architecture, run `go env`.
2. Build this project using command `env GOOS=<YOUR_OS> GOARCH=<YOUR_ARCH> go build -v -o bin/api`.
3. Give output permission to execute.
4. Run the server, depending on your operating system.

> Next update will be support for docker
### Docker build:
1. Make sure you have installed docker on your machine.
2. Build the project using command `docker build . `
3. Start the project using command `docker run -h localhost -p 8000:8000 -e PORT=8000 rust-updater-api_app:latest`

## Contact
If you need more information please join the discord: https://discord.chroma-gaming.xyz/
Expand Down
2 changes: 1 addition & 1 deletion api/gateways/routes/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ func (ur *Route) Init(e *echo.Echo) {
g := e.Group("/api")

r := g.Group("/notifier")
r.GET("/", ur.Handler.GetUpdater)
r.GET("", ur.Handler.GetUpdater)
}
3 changes: 3 additions & 0 deletions routes/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import (
"github.com/Aldiwildan77/rust-notifier-api/api"
"github.com/Aldiwildan77/rust-notifier-api/api/gateways/routes"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)

func Register(e *echo.Echo) {
e.Pre(middleware.RemoveTrailingSlash())

e.GET("/health", func(c echo.Context) error {
return c.String(http.StatusOK, "Iam fine thanks")
})
Expand Down

0 comments on commit f3d1ad8

Please sign in to comment.