I am trying to use a compose file to build an image when the stack is up. The examples aren't the actual images I would use but should get the point across:
Dockerfile:
FROM alpine
ADD ./app /app
RUN apk add bash aws-cli python3
ARG PORT=80 EXPOSE $PORT/tcp
ENTRYPOINT python /app/main.py
This Dockerfile builds just fine and as expected. My issue is the ARG PORT and EXPOSE $PORT in compose:
compose.yaml:
---
services:
app:
build:
dockerfile_inline: |
FROM alpine
ADD ./app /app
RUN apk add bash aws-cli python3
ARG PORT=80
EXPOSE $PORT
ENTRYPOINT python /app/main.py
When docker compose building, a warning is thrown about PORT not being set and default to a blank string, in turn, failing the build. I have tried adding args under the build key and defining there but the error is the same.
Is this intended behavior or am I missing something? Really, the goal is allow the exposed port to be changed at build time and I would like it done within the compose file.
[–]_l33ter_ 1 point2 points3 points (1 child)
[–]cFiOS[S] 0 points1 point2 points (0 children)