From 04fce7714b5291b62e0638df5941817c94545dba Mon Sep 17 00:00:00 2001 From: Ugo Sangiorgi Date: Fri, 11 Nov 2022 17:05:50 -0500 Subject: [PATCH] possible fix docker --- .github/workflows/docker-release.yml | 33 ------------------- .../{github-release.yml => release.yml} | 19 +++++++++++ Dockerfile | 17 +++------- docker-compose.yml | 2 +- 4 files changed, 25 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/docker-release.yml rename .github/workflows/{github-release.yml => release.yml} (85%) diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml deleted file mode 100644 index b29591e..0000000 --- a/.github/workflows/docker-release.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: docker-release - -on: - push: - tags: - - 'v*' - -jobs: - logshark_doo_doo_doo_doo: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v3 - with: - images: ugosan/logshark - - - name: Build and push - uses: docker/build-push-action@v3.2.0 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/github-release.yml b/.github/workflows/release.yml similarity index 85% rename from .github/workflows/github-release.yml rename to .github/workflows/release.yml index 2b04cb1..24320e7 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/release.yml @@ -92,3 +92,22 @@ jobs: asset_name: logshark-windows-amd64-${{ github.ref_name }}.tar.gz asset_content_type: application/gzip + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: ugosan/logshark + + - name: Build and push + uses: docker/build-push-action@v3.2.0 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index be5252a..2402eba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,8 @@ -FROM --platform=$BUILDPLATFORM golang:1.19 as builder -ENV TERM "xterm-256color" -ARG TARGETARCH - -WORKDIR /build -COPY . /build -RUN GOOS=linux GOARCH=$TARGETARCH go build -buildmode exe -ldflags="-w -s" -o ./logshark ./cmd - -FROM alpine:latest -WORKDIR /root -COPY --from=builder /build/logshark /usr/local/bin/logshark -ENTRYPOINT ["logshark"] +FROM progrium/busybox +RUN opkg-install bash +ENV TERM "xterm-256color" +ADD dist/linux-amd64/logshark /usr/local/bin/logshark +ENTRYPOINT ["logshark"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 0deb9a1..e5024bc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: #note you should not use "docker-compose up" but instead "docker-compose run logshark sh" since docker-compose doesnt attach to containers with "up". e.g. docker-compose run -p 9200:9200 logshark -port 9200 logshark: - image: ugosan/logshark + image: ugosan/logshark:latest tty: true stdin_open: true \ No newline at end of file