Skip to content

Commit 23e2b88

Browse files
committed
make it docker port build exposable
1 parent 1b809a5 commit 23e2b88

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ RUN go build -o smartadapter main.go
88
FROM alpine:latest
99
WORKDIR /app
1010
COPY --from=builder /app/smartadapter .
11-
EXPOSE 8080
11+
# Dynamically expose the port specified by the PORT environment variable (default 8080)
12+
ARG PORT=8080
13+
ENV PORT=${PORT}
14+
EXPOSE ${PORT}
1215
ENTRYPOINT ["./smartadapter"]

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@ You can add any number of custom headers to be forwarded to the target by repeat
2121

2222
You can use the Docker image directly from the GitHub repository, or build it yourself.
2323

24-
### Build and run locally:
24+
### Dynamic Port Exposure
25+
26+
The Dockerfile exposes the port dynamically based on the `PORT` environment variable (default: 8080). To run the container on a custom port, set the `PORT` environment variable and map the same port:
2527

2628
```
27-
docker build -t kalvadtech/smartadapter .
28-
docker run -p 8080:8080 kalvadtech/smartadapter -target https://sandboxapi.customerpulse.gov.ae/ -port 8080 -H "X-Integration-Apikey: your-api-key" -H "X-Another-Header: another-value"
29+
docker run -e PORT=9090 -p 9090:9090 ghcr.io/kalvadtech/smartadapter:latest -target https://sandboxapi.customerpulse.gov.ae/ -port 9090 -H "X-Integration-Apikey: your-api-key"
2930
```
3031

31-
### Or pull from GitHub Container Registry (if published):
32+
If you do not set `PORT`, it defaults to 8080:
33+
34+
35+
## Pull from GitHub Container Registry :
3236

3337
```
3438
docker pull ghcr.io/kalvadtech/smartadapter:latest

0 commit comments

Comments
 (0)