Skip to content

Commit

Permalink
fix: add expose port
Browse files Browse the repository at this point in the history
  • Loading branch information
cao7113 committed Jul 9, 2024
1 parent 162644d commit a0daaee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Docker Try
on:
push:
branches: ["docker"]
branches:
- docker
workflow_dispatch:
workflow_call:

Expand All @@ -16,11 +17,11 @@ jobs:
image: cao7113/hello-api-elixir
ports:
- 4000:4000
# Fix: unsupported media type application/vnd.oci.empty.v1+json
# use ghcr.io/cao7113/hello-api-elixir:v0.1.8 or ghcr.io/cao7113/hello-api-elixir:latest instead of ghcr.io/cao7113/hello-api-elixir:sha256-b3de0aa2c4d72189aeb6e36fe8377400e1f9e6f4fbc60270b3e05b2e3350462b

# https://github.com/cao7113/hello-api-elixir/pkgs/container/hello-api-elixir
# Fix: "unsupported media type application/vnd.oci.empty.v1+json"
# use ghcr.io/cao7113/hello-api-elixir:v0.1.8 instead of ghcr.io/cao7113/hello-api-elixir:sha256-b3de0aa2c4d72189aeb6e36fe8377400e1f9e6f4fbc60270b3e05b2e3350462b
api-server2:
# https://github.com/cao7113/hello-api-elixir/pkgs/container/hello-api-elixir
# image: ghcr.io/cao7113/hello-api-elixir:v0.1.8
image: ghcr.io/cao7113/hello-api-elixir
ports:
- 4002:4000
Expand All @@ -32,10 +33,14 @@ jobs:
- name: Ping api-server
run: |
sleep 1
echo Ping api-server
curl -sSL http://localhost:4000/ping
echo Ping api-server2
curl -sSL http://localhost:4002/ping
- name: Api build info
run: |
echo api-server build info:
curl -sSL http://localhost:4000 | jq
echo api-server2 build info:
curl -sSL http://localhost:4002 | jq
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ RUN chown nobody /app

# set runner ENV
ENV MIX_ENV="prod"
ENV PORT="4000"
# Appended by flyctl https://fly.io/docs/elixir/getting-started/#important-ipv6-settings
ENV ECTO_IPV6 true
ENV ERL_AFLAGS "-proto_dist inet6_tcp"
EXPOSE ${PORT}

# Only copy the final release from the build stage
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/hello_api ./
Expand Down

0 comments on commit a0daaee

Please sign in to comment.