Merge branch 'master' of github.com:gradido/gradido into 1904-mirror-volume-for-backend-log-files-in-docker

This commit is contained in:
Wolfgang Huß 2022-07-21 13:38:55 +02:00
commit 2d61025e29
5 changed files with 109 additions and 11 deletions

44
DOCKER_MORE_CLOSELY.md Normal file
View File

@ -0,0 +1,44 @@
# Docker More Closely
## Apple M1 Platform
***Attention:** For using Docker commands in Apple M1 environments!*
### Enviroment Variable For Apple M1 Platform
To set the Docker platform environment variable in your terminal tab, run:
```bash
# set env variable for your shell
$ export DOCKER_DEFAULT_PLATFORM=linux/amd64
```
### Docker Compose Override File For Apple M1 Platform
For Docker compose `up` or `build` commands, you can use our Apple M1 override file that specifies the M1 platform:
```bash
# in main folder
# for development
$ docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.apple-m1.override.yml up
# for production
$ docker compose -f docker-compose.yml -f docker-compose.apple-m1.override.yml up
```
## Analysing Docker Builds
To analyze a Docker build, there is a wonderful tool called [dive](https://github.com/wagoodman/dive). Please sponsor if you're using it!
The `dive build` command is exactly the right one to fulfill what we are looking for.
We can use it just like the `docker build` command and get an analysis afterwards.
So, in our main folder, we use it in the following way:
```bash
# in main folder
$ dive build --target <layer-name> -t "gradido/<app-name>:local-<layer-name>" <app-folder-name-or-dot>/
```
For the specific applications, see our [publish.yml](.github/workflows/publish.yml).

View File

@ -0,0 +1,43 @@
# This file defines the Apple M1 chip settings. It overrides docker-compose.override.yml,
# which defines the development settings.
# To use it it is required to explicitly define if you want to build with it:
# > docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.apple-m1.override.yml up
version: "3.4"
services:
########################################################
# FRONTEND #############################################
########################################################
frontend:
platform: linux/amd64
########################################################
# ADMIN INTERFACE ######################################
########################################################
admin:
platform: linux/amd64
#########################################################
## MARIADB ##############################################
#########################################################
mariadb:
platform: linux/amd64
########################################################
# BACKEND ##############################################
########################################################
backend:
platform: linux/amd64
########################################################
# DATABASE #############################################
########################################################
database:
platform: linux/amd64
#########################################################
## NGINX ################################################
#########################################################
nginx:
platform: linux/amd64

View File

@ -1,11 +1,13 @@
version: "3.4" version: "3.4"
services: services:
######################################################## ########################################################
# FRONTEND ############################################# # FRONTEND #############################################
######################################################## ########################################################
frontend: frontend:
image: gradido/frontend:development # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
image: gradido/frontend:local-development
build: build:
target: development target: development
environment: environment:
@ -22,7 +24,8 @@ services:
# ADMIN INTERFACE ###################################### # ADMIN INTERFACE ######################################
######################################################## ########################################################
admin: admin:
image: gradido/admin:development # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
image: gradido/admin:local-development
build: build:
target: development target: development
environment: environment:
@ -39,7 +42,8 @@ services:
# BACKEND ############################################## # BACKEND ##############################################
######################################################## ########################################################
backend: backend:
image: gradido/backend:development # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
image: gradido/backend:local-development
build: build:
target: development target: development
networks: networks:
@ -62,10 +66,11 @@ services:
######################################################## ########################################################
database: database:
# we always run on production here since else the service lingers # we always run on production here since else the service lingers
# feel free to change this behaviour if it seems useful # feel free to change this behaviour if it seems useful
# Due to problems with the volume caching the built files # Due to problems with the volume caching the built files
# we changed this to test build. This keeps the service running. # we changed this to test build. This keeps the service running.
image: gradido/database:test_up # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
image: gradido/database:local-test_up
build: build:
target: test_up target: test_up
environment: environment:

View File

@ -6,6 +6,7 @@ services:
# BACKEND ############################################## # BACKEND ##############################################
######################################################## ########################################################
backend: backend:
# name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
image: gradido/backend:test image: gradido/backend:test
build: build:
target: test target: test

View File

@ -6,11 +6,13 @@
version: "3.4" version: "3.4"
services: services:
######################################################## ########################################################
# FRONTEND ############################################# # FRONTEND #############################################
######################################################## ########################################################
frontend: frontend:
image: gradido/frontend:latest # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
image: gradido/frontend:local-production
build: build:
context: ./frontend context: ./frontend
target: production target: production
@ -35,7 +37,8 @@ services:
# ADMIN INTERFACE ###################################### # ADMIN INTERFACE ######################################
######################################################## ########################################################
admin: admin:
image: gradido/admin:latest # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
image: gradido/admin:local-production
build: build:
context: ./admin context: ./admin
target: production target: production
@ -78,7 +81,8 @@ services:
# BACKEND ############################################## # BACKEND ##############################################
######################################################## ########################################################
backend: backend:
image: gradido/backend:latest # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
image: gradido/backend:local-production
build: build:
# since we have to include the entities from ./database we cannot define the context as ./backend # since we have to include the entities from ./database we cannot define the context as ./backend
# this might blow build image size to the moon ?! # this might blow build image size to the moon ?!
@ -112,7 +116,8 @@ services:
# DATABASE ############################################# # DATABASE #############################################
######################################################## ########################################################
database: database:
#image: gradido/database:production_up # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
image: gradido/database:local-production_up
build: build:
context: ./database context: ./database
target: production_up target: production_up