From a85fd7535c90de354852a601fa1a4f1a650d5598 Mon Sep 17 00:00:00 2001 From: Ryn Cao Date: Mon, 8 Jul 2024 15:15:52 +0800 Subject: [PATCH] chore: test api in docker --- .github/workflows/cd.yml | 1 + .github/workflows/docker.yml | 28 ++++++++++++++++++++++++++++ Taskfile.yml | 1 + 3 files changed, 30 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 7ec3b0b..09665ad 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -68,6 +68,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + ## enable below??? https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-docker-hub # - name: Generate artifact attestation # uses: actions/attest-build-provenance@v1 # with: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..69b393c --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,28 @@ +name: Docker Try +on: + push: + branches: ["docker"] + +permissions: + contents: read + +jobs: + test-docker: + runs-on: ubuntu-latest + services: + api-server: + image: cao7113/hello-api-elixir + env: + MIX_ENV: prod + ports: + - 4000:4000 + + steps: + # - name: Checkout code + # uses: actions/checkout@v4 + + - name: Ping api-server + run: | + sleep 3 + curl http://localhost:4000/ping + curl http://localhost:4000 diff --git a/Taskfile.yml b/Taskfile.yml index 55281ad..9192069 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -47,6 +47,7 @@ tasks: ## Docker env dk-builder: docker pull hexpm/elixir:1.17.1-erlang-27.0-debian-bullseye-20240612-slim dk-runner: docker pull debian:bullseye-20240612-slim + # dockerhub image: https://hub.docker.com/r/cao7113/hello-api-elixir # Init setup mk-hello: mix new hello-api-elixir --app hello_api --sup