Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add content for dockerfile #51

Open
MichaelCurrin opened this issue Jan 8, 2024 · 0 comments
Open

Add content for dockerfile #51

MichaelCurrin opened this issue Jan 8, 2024 · 0 comments

Comments

@MichaelCurrin
Copy link
Owner

## Fields

Setting fields like `dockerfile`, `command`, `volume` and `environment`.

```yaml
services:
  mya_app:
    build:
      context: ..
      dockerfile: .devcontainer/Dockerfile
    command: sleep infinity
    volumes:
      - ..:/workspace
    environment:
      - DEBUG=0
      - ENVIRONMENT=local
    ports:
      - "8000:8000"
      - "8081:8081"
    depends_on:
      - my_app_db
```

For external services, it can be shorter:

```yaml
services:
  my_app_db:
    image: postgres:14
    volumes:
      - my_app_db_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U commodities" ]
      interval: 5s
      timeout: 5s
      retries: 5

  redis:
    image: redis:alpine
    ports:
      - "6379:6379"

  nginx:
    container_name: nginx
    image: nginx:1.18
    ports:
      - "80:80"
    volumes:
      - "./nginx.conf:/etc/nginx/conf.d/default.conf"
```

You can set credentials in `environment` for a DB but it could be better to use unversioned secrets file instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant