From d972a4920f0dc32adad29998d94dd9ad2d9ba9e0 Mon Sep 17 00:00:00 2001 From: Amaototi Date: Tue, 20 Jun 2023 19:36:19 +0900 Subject: [PATCH] Update Docker and Github Workflows --- .github/workflows/docker-image.yml | 1 + .github/workflows/go.yml | 47 ++++++++++++++++++++++++++++++ Dockerfile | 7 ++--- 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 8b03707..b042273 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -22,5 +22,6 @@ jobs: id: docker_build uses: docker/build-push-action@v3 with: + platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 push: true tags: ghcr.io/tpc3/noa:latest \ No newline at end of file diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..122ddbd --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,47 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + arch: [linux-amd64, linux-arm, linux-arm64] + include: + - arch: linux-amd64 + goos: linux + goarch: amd64 + - arch: linux-arm + goos: linux + goarch: arm + - arch: linux-arm64 + goos: linux + goarch: arm64 + + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.19 + + - name: Build + run: mkdir -p bin/${{ matrix.goos }}/${{ matrix.goarch }} + - name: Build + run: go build -o bin/${{ matrix.goos }}/${{ matrix.goarch }}/ + env: + CGO_ENABLED: 0 + GOARCH: ${{ matrix.goarch }} + GOOS: ${{ matrix.goos }} + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v2.2.4 + with: + # Artifact name + path: bin \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index bb16c64..d7b3c6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,10 @@ FROM golang -RUN apt update && apt install -y mecab libmecab-dev mecab-ipadic-utf8 +RUN apt update ENV GO111MODULE on -ENV CGO_LDFLAGS -L/usr/lib/x86_64-linux-gnu -lmecab -lstdc++ -ENV CGO_CFLAGS -I/usr/include -RUN ln -s /usr/local/lib/libmecab.so.2.0.0 /lib64/libmecab.so.2 ADD . /go/src/Noa/ ARG GOARCH=amd64 ENV GOARCH ${GOARCH} -ENV CGO_ENABLED 1 +ENV CGO_ENABLED 0 WORKDIR /go/src/Noa RUN go build -o noa . CMD ["./noa"]