Skip to content

Commit

Permalink
feat: support docker
Browse files Browse the repository at this point in the history
  • Loading branch information
VaalaCat committed Sep 1, 2022
1 parent 87350ab commit bd8345a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
movie-sync-server*
.idea
.DS_Store
.DS_Store
dist
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine

COPY movie-sync-server-linux-amd64 /app/bin/movie-sync-server-linux-amd64

COPY dist /app/asset

WORKDIR /app/bin

CMD [ "/app/bin/movie-sync-server-linux-amd64" ]
8 changes: 4 additions & 4 deletions build.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GOOS=linux GOARCH=mipsle go build -o movie-sync-server-linux-mipsle
GOOS=linux GOARCH=amd64 go build -o movie-sync-server-linux-amd64
GOOS=linux GOARCH=arm64 go build -o movie-sync-server-linux-arm64
GOOS=linux GOARCH=mips go build -o movie-sync-server-linux-mips
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -o movie-sync-server-linux-mipsle
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o movie-sync-server-linux-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o movie-sync-server-linux-arm64
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -o movie-sync-server-linux-mips
GOOS=windows GOARCH=amd64 go build -o movie-sync-server-win-amd64.exe
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package main

import (
"fmt"
"github.com/gin-gonic/gin"
socketio "github.com/googollee/go-socket.io"
"github.com/joho/godotenv"
"log"
"net/http"
"os"
"strconv"
"strings"

"github.com/gin-gonic/gin"
socketio "github.com/googollee/go-socket.io"
"github.com/joho/godotenv"
)

func GinMiddleware(allowOrigin string) gin.HandlerFunc {
Expand Down Expand Up @@ -418,7 +419,7 @@ func main() {
// 从.env文件中读取端口号
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
log.Println("Error loading .env file")
}
port := os.Getenv("PORT")
allowOrigin := os.Getenv("ALLOW_ORIGIN")
Expand Down

0 comments on commit bd8345a

Please sign in to comment.