After reviewing the answers on How to name Dockerfiles I'm still left with a lot of questions.
In my case, I am needing at least two Dockerfile
s, a docker-compose.yaml
and a .dockerignore
. It sounds like using an extension such as <purpose>.Dockerfile
or Dockerfile.<purpose>
has the drawback of losing the functionality of using autobuilder at hub.docker.com.
So others are suggesting you keep each Dockerfile
in a directory and build from there.
So maybe something like:
dockerfiles/
--python_consumer/
-----Dockerfile
--python_producer/
-----Dockerfile
--docker-compose.yaml
--.dockerignore
Would the .dockerignore in this case work globally for all of the dockerfiles? Any big drawbacks to structuring this way?
Example of my docker-compose.yaml
without separate directories and one combined consumer/production image for context.
version: '3.8'
services:
standalone:
hostname: standalone
container_name: standalone
image: apachepulsar/pulsar:2.8.1
ports:
- 8080:8080 # exposed would be a better practice
- 6650:6650 # exposed would be a better practice
command: bin/pulsar standalone
healthcheck:
test: ["CMD", "nc", "-vz", "localhost", "6650"]
interval: 20s
timeout: 5s
retries: 5
networks:
- conprod
conprod:
hostname: conprod
container_name: conprod
build:
context: .
dockerfile: ./Dockerfile
restart: on-failure # best practice is probably "unless-stopped"
depends_on:
- standalone
networks:
- conprod
networks:
conprod: