14 Commits

Author SHA1 Message Date
Shizun Ge
b90cdfc2a1 change tag to development 2022-10-12 19:04:21 -07:00
Shizun Ge
e8f7a1b0bb keep only amd64, arm64 and armv7 builds 2022-10-12 18:57:42 -07:00
Shizun Ge
7d78f5161e do not update description on development builds 2022-10-12 18:50:11 -07:00
Shizun Ge
46e5a624be use distroless as base 2022-10-12 18:46:37 -07:00
Shizun Ge
5e4c3bb21a build docker image on push to main 2022-10-12 18:43:43 -07:00
Shizun Ge
75d7307134 Merge pull request #32 from shizunge/dependabot/github_actions/docker/login-action-2.1.0
Bump docker/login-action from 2.0.0 to 2.1.0
2022-10-12 17:41:28 -07:00
Shizun Ge
ece420b56b Merge pull request #33 from shizunge/dependabot/github_actions/docker/build-push-action-3.2.0
Bump docker/build-push-action from 3.1.1 to 3.2.0
2022-10-12 17:41:19 -07:00
Shizun Ge
c87861b4d6 Merge pull request #34 from shizunge/dependabot/github_actions/docker/setup-buildx-action-2.1.0
Bump docker/setup-buildx-action from 2.0.0 to 2.1.0
2022-10-12 17:41:08 -07:00
dependabot[bot]
69ea717d13 Bump docker/setup-buildx-action from 2.0.0 to 2.1.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-13 00:39:53 +00:00
dependabot[bot]
ff87416602 Bump docker/build-push-action from 3.1.1 to 3.2.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.1.1...v3.2.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-13 00:39:50 +00:00
dependabot[bot]
231518cb79 Bump docker/login-action from 2.0.0 to 2.1.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-13 00:39:44 +00:00
Shizun Ge
0950175e43 Merge pull request #31 from shizunge/prometheus
update Docker build base
2022-10-10 20:21:55 -07:00
Shizun Ge
d7c0c2ed79 Merge branch 'master' into prometheus 2022-10-10 20:08:58 -07:00
Shizun Ge
e8d7ae0889 update Docker build base 2022-10-10 20:06:59 -07:00
3 changed files with 68 additions and 11 deletions

View File

@@ -0,0 +1,56 @@
name: Build docker image and push to docker hub on release
on:
push:
branches:
- main
env:
PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"
jobs:
build_and_push:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract tag string
id: git
shell: bash
run: |
RELEASE_VERSION="dev-$(date +%s)"
echo "::set-output name=image_tag::${RELEASE_VERSION}"
echo "Action image_tag=${RELEASE_VERSION}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Install buildx
uses: docker/setup-buildx-action@v2.1.0
- name: Login to docker hub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
uses: docker/build-push-action@v3.2.0
with:
platforms: ${{ env.PLATFORMS }}
push: true
tags: |
${{ github.repository }}:${{ steps.git.outputs.image_tag }}
${{ github.repository }}:development
ghcr.io/${{ github.repository }}:${{ steps.git.outputs.image_tag }}
ghcr.io/${{ github.repository }}:development

View File

@@ -5,7 +5,7 @@ on:
types: # This configuration does not affect the page_build event above
- created
env:
PLATFORMS: "linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x"
PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"
jobs:
build_and_push:
@@ -27,23 +27,23 @@ jobs:
uses: docker/setup-qemu-action@v2
- name: Install buildx
uses: docker/setup-buildx-action@v2.0.0
uses: docker/setup-buildx-action@v2.1.0
- name: Login to docker hub
uses: docker/login-action@v2.0.0
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.0.0
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
uses: docker/build-push-action@v3.1.1
uses: docker/build-push-action@v3.2.0
with:
platforms: ${{ env.PLATFORMS }}
push: true

View File

@@ -1,19 +1,20 @@
FROM golang:alpine AS build
FROM golang AS build
ADD . /go/src/app
WORKDIR /go/src/app
RUN mkdir /endlessh
ADD . /endlessh
WORKDIR /endlessh
RUN go mod tidy
RUN go build -o endlessh .
FROM alpine:latest
FROM gcr.io/distroless/base
LABEL org.opencontainers.image.title=endlessh-go
LABEL org.opencontainers.image.description="Endlessh: an SSH tarpit"
LABEL org.opencontainers.image.vendor="Shizun Ge"
LABEL org.opencontainers.image.licenses=GPLv3
COPY --from=build /go/src/app/endlessh /usr/bin/endlessh
COPY --from=build /endlessh/endlessh /endlessh
EXPOSE 2222 2112
USER nobody
ENTRYPOINT ["/usr/bin/endlessh"]
ENTRYPOINT ["/endlessh"]
CMD ["-logtostderr", "-v=1"]