Last active
March 5, 2025 13:08
-
-
Save davidalves1/ac1a7282f65b7cd79da612a1f4857537 to your computer and use it in GitHub Desktop.
Awesome list of docker compose files and helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
awesome-db: | |
image: mariadb:10.3 | |
command: "--character-set-server=utf8 --collation-server=utf8_general_ci --innodb-use-native-aio=0" | |
restart: "no" | |
ports: | |
- "3306" | |
volumes: | |
- "./.docker/dbdata:/var/lib/mysql" | |
environment: | |
MYSQL_DATABASE: my_awesome_db | |
MYSQL_ROOT_PASSWORD: root123 | |
MYSQL_ROOT_HOST: "%" | |
awesome-adminer: | |
image: adminer:latest | |
restart: "no" | |
ports: | |
- 8080:8080 | |
depends_on: | |
- awesome-db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
app: | |
container_name: my-app | |
build: . | |
entrypoint: sh -c "yarn install --frozen-lockfile && yarn dev" | |
environment: | |
- CHOKIDAR_USEPOLLING=true | |
ports: | |
- 3000:3000 | |
- 24678:24678 | |
networks: | |
- app-network | |
volumes: | |
- .:/app | |
- /app/node_modules | |
depends_on: | |
- db | |
db: | |
container_name: my-postgres | |
image: postgres:latest | |
environment: | |
- POSTGRES_USER=Admin | |
- POSTGRES_PASSWORD=Admin123 | |
- POSTGRES_DB=postgres #optional (specify default database instead of $POSTGRES_DB) | |
ports: | |
- '5432:5432' | |
networks: | |
- app-network | |
volumes: | |
- postgres-data:/var/lib/postgresql/data | |
adminer: | |
container_name: my-adminer | |
image: adminer | |
restart: always | |
ports: | |
- 5005:8080 | |
depends_on: | |
- db | |
networks: | |
- app-network | |
networks: | |
app-network: | |
volumes: | |
postgres-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:20.11.0-alpine3.19 | |
# RUN adduser -D appuser | |
# USER appuser | |
WORKDIR /app | |
COPY package.json yarn.lock /app | |
RUN rm -rf /app/node_modules \ | |
&& yarn install --frozen-lockfile | |
COPY . /app | |
EXPOSE 3000 | |
CMD [ "yarn", "dev" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PHONY: up down logs shell | |
logs: | |
docker compose logs -f app | |
up: | |
docker compose up -d && make logs | |
up-build: | |
docker compose up --build -d && make logs | |
up-force: | |
docker compose up --force-recreate -d && make logs | |
stop: | |
docker compose stop | |
down: | |
docker compose down --volumes --rmi local --remove-orphans | |
shell: | |
docker compose exec app sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment