diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml index a90fa1c..16267e6 100644 --- a/.github/workflows/ghcr.yml +++ b/.github/workflows/ghcr.yml @@ -3,9 +3,9 @@ name: Push Docker image on: push: branches-ignore: - - '**' + - "**" tags: - - 'v*' + - "v*" env: REGISTRY: ghcr.io @@ -46,7 +46,8 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v5 with: - context: ./build/package + context: . + file: ./build/package/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/build/package/Dockerfile b/build/package/Dockerfile index d73edde..b53429f 100644 --- a/build/package/Dockerfile +++ b/build/package/Dockerfile @@ -1,15 +1,13 @@ -FROM ubuntu:22.04 +FROM golang:1.22.4 LABEL maintainer "Motoki TAKENAKA " +WORKDIR /pola + +COPY . . + # Install packages RUN apt-get update \ - && apt-get install -y bash-completion curl iproute2 - -# Setup Go 1.22.2 -RUN curl -o ~/go1.22.2.linux-amd64.tar.gz -LO https://go.dev/dl/go1.22.2.linux-amd64.tar.gz \ - && rm -rf /usr/local/go \ - && tar -C /usr/local -xzf ~/go1.22.2.linux-amd64.tar.gz \ - && echo "export PATH=$PATH:/usr/local/go/bin" > ~/.bashrc + && apt-get install -y bash-completion curl iproute2 wget vim iputils-ping net-tools # Enable Completion RUN echo "" >> ~/.bashrc \ @@ -18,10 +16,12 @@ RUN echo "" >> ~/.bashrc \ && echo "fi" >> ~/.bashrc # Install Pola -SHELL ["/bin/bash", "-l", "-c"] -ENV GOBIN /usr/local/go/bin -RUN go install github.com/nttcom/pola/cmd/...@latest +SHELL ["/bin/bash", "-c"] +RUN go install ./cmd/... + +# remove build directory +RUN rm -rf ./* # Add completion RUN pola completion bash | tee -a /usr/share/bash-completion/completions/pola >/dev/null \