Skip to content

Commit

Permalink
feat(docker): improve docker-compose
Browse files Browse the repository at this point in the history
Add networks and container names.
  • Loading branch information
berdal84 committed Apr 27, 2024
1 parent fa1c5f9 commit 90a9f80
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion client/ng/src/environments/environment.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Environment} from './environment.model';

export const environmentBase = {
api: {
baseUrl: '127.0.0.1:8000',
baseUrl: 'http://127.0.0.1:8000',
path: {
auth: '/authentication.php',
mail: '/mail.php',
Expand Down
43 changes: 32 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
version: '3.8'
name: jeudemots
services:

# TODO: Frontend - serve the Angular app
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
# TODO
# frontend:
# image: nginx:stable
# depends_on:
# - api
# ports:
# - 80:80

# API - run PHP app
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
api:
container_name: jeudemots-api
image: php:7.2-apache
command: | # TODO: convert that to a Dockerfile
/bin/sh -c 'docker-php-ext-install mysqli &&
exec docker-php-entrypoint apache2-foreground'
depends_on:
- db
volumes:
- ./server/src:/var/www/html:ro
ports:
- 8000:80

# Database - store jokes in a MySQL db
networks: ['backend']
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
db:
container_name: jeudemots-db
image: mariadb:10.3
restart: always
environment:
MYSQL_ROOT_PASSWORD: 'devonly'

# Database Admin Panel
networks: ['backend']
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
phpmyadmin:
container_name: jeudemots-phpmyadmin
image: phpmyadmin:5
depends_on:
- db
Expand All @@ -36,6 +49,14 @@ services:
PMA_USER: 'root'
PMA_PASSWORD: 'devonly'
ports:
- 8080:80 # internal

- 8080:80
networks: ['backend', 'frontend']
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
networks:
frontend:
name: jeudemots-frontend
backend:
name: jeudemots-backend

0 comments on commit 90a9f80

Please sign in to comment.