Skip to content

Instantly share code, notes, and snippets.

@kwbr
Forked from aprxi/docker-compose.yml
Created March 25, 2021 06:25
Show Gist options
  • Save kwbr/a6b5ee2b73fe9af82add451bf53583f2 to your computer and use it in GitHub Desktop.
Save kwbr/a6b5ee2b73fe9af82add451bf53583f2 to your computer and use it in GitHub Desktop.
docker-compose.yml_20190214
version: '3.4'
services:
main:
# Makefile fills PROJECT_NAME to current directory name.
# add UID to allow multiple users run this in parallel
container_name: ${PROJECT_NAME}_${HOST_UID:-4000}
hostname: ${PROJECT_NAME}
# These variables are passed into the container.
environment:
- UID=${HOST_UID:-4000}
# Run with user priviliges by default.
user: ${HOST_USER:-nodummy}
image: ${PROJECT_NAME}:${HOST_USER:-nodummy}
build:
context: .
# Build for current user.
target: user
dockerfile: Dockerfile
# These variables are passed to Dockerfile.
args:
- HOST_UID=${HOST_UID:-4000}
- HOST_USER=${HOST_USER:-nodummy}
# Run container as a service. Replace with something useful.
command: ["tail", "-f", "/dev/null"]
# Copy current (git-) project into container.
volumes:
- ${PWD:-.}:/home/${HOST_USER}/${PROJECT_NAME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment