Merge pull request #5073 from Ocelot-Social-Community/5072-remove-image-entries-in-docker-compose-files-fix-m1

chore: 🍰 Change `image` Entries In Docker Compose Files And Fix Apple M1 Problem
This commit is contained in:
Wolfgang Huß 2022-07-18 20:01:13 +02:00 committed by GitHub
commit 50344b4745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 112 additions and 30 deletions

View File

@ -13,6 +13,26 @@ To set the Docker platform environment variable in your terminal tab, run:
$ 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
# clean db
$ docker compose exec backend yarn db:reset
# seed db
$ docker compose exec backend yarn db:seed
# for production
$ docker compose -f docker-compose.yml -f docker-compose.apple-m1.override.yml up
# init admin user
$ docker compose exec backend /bin/sh -c "yarn prod:migrate init"
```
## 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!

View File

@ -0,0 +1,34 @@
version: "3.4"
services:
########################################################
# WEBAPP ###############################################
########################################################
webapp:
platform: linux/amd64
########################################################
# BACKEND ##############################################
########################################################
backend:
platform: linux/amd64
########################################################
# MAINTENANCE ##########################################
########################################################
maintenance:
platform: linux/amd64
########################################################
# NEO4J ################################################
########################################################
neo4j:
platform: linux/amd64
########################################################
# MAILSERVER TO FAKE SMTP ##############################
########################################################
# commented out, because otherwise override of production would error. and it seems unnecessary
# mailserver:
# platform: linux/amd64

View File

@ -1,3 +1,5 @@
# Todo: !!! This file seems related to our old maintenance worker for MongoDB and has to be refactored in case of using it !!!
version: "3.4"
services:

View File

@ -1,11 +1,13 @@
version: "3.4"
services:
########################################################
# WEBAPP ###############################################
########################################################
webapp:
image: ocelotsocialnetwork/webapp: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: ocelotsocialnetwork/webapp:local-development
build:
target: development
environment:
@ -18,11 +20,13 @@ services:
- webapp_node_modules:/app/node_modules
# bind the local folder to the docker to allow live reload
- ./webapp:/app
########################################################
# BACKEND ##############################################
########################################################
backend:
image: ocelotsocialnetwork/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: ocelotsocialnetwork/backend:local-development
build:
target: development
environment:
@ -34,22 +38,27 @@ services:
- backend_node_modules:/app/node_modules
# bind the local folder to the docker to allow live reload
- ./backend:/app
########################################################
# MAINTENANCE ##########################################
########################################################
maintenance:
# 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: ocelotsocialnetwork/maintenance:local-development
########################################################
# NEO4J ################################################
########################################################
neo4j:
image: ocelotsocialnetwork/neo4j-community: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: ocelotsocialnetwork/neo4j-community:local-development
ports:
# Also expose the neo4j query browser
- 7474:7474
networks:
# So we can access the neo4j query browser from our host machine
- external-net
########################################################
# MAINTENANCE ##########################################
########################################################
maintenance:
image: ocelotsocialnetwork/maintenance:development
########################################################
# MAILSERVER TO FAKE SMTP ##############################
########################################################

View File

@ -1,10 +1,12 @@
version: "3.4"
services:
########################################################
# WEBAPP ###############################################
########################################################
webapp:
# 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: ocelotsocialnetwork/webapp:test
build:
target: test
@ -12,10 +14,12 @@ services:
- NODE_ENV="test"
volumes:
- ./coverage:/app/coverage
########################################################
# 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: ocelotsocialnetwork/backend:test
build:
target: test
@ -23,10 +27,19 @@ services:
- NODE_ENV="test"
volumes:
- ./coverage:/app/coverage
########################################################
# MAINTENANCE ##########################################
########################################################
maintenance:
# 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: ocelotsocialnetwork/maintenance:test
########################################################
# NEO4J ################################################
########################################################
neo4j:
# 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: ocelotsocialnetwork/neo4j-community:test
#environment:
# - NEO4J_dbms_connector_bolt_enabled=true
@ -39,11 +52,7 @@ services:
networks:
# So we can access the neo4j query browser from our host machine
- external-net
########################################################
# MAINTENANCE ##########################################
########################################################
maintenance:
image: ocelotsocialnetwork/maintenance:test
########################################################
# MAILSERVER TO FAKE SMTP ##############################
########################################################

View File

@ -6,11 +6,13 @@
version: "3.4"
services:
########################################################
# WEBAPP ###############################################
########################################################
webapp:
image: ocelotsocialnetwork/webapp: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: ocelotsocialnetwork/webapp:local-production
build:
context: ./webapp
target: production
@ -35,11 +37,13 @@ services:
- GRAPHQL_URI=http://backend:4000
env_file:
- ./webapp/.env
########################################################
# BACKEND ##############################################
########################################################
backend:
image: ocelotsocialnetwork/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: ocelotsocialnetwork/backend:local-production
build:
context: ./backend
target: production
@ -67,11 +71,28 @@ services:
- CLIENT_URI=http://webapp:3000
env_file:
- ./backend/.env
########################################################
# MAINTENANCE ##########################################
########################################################
maintenance:
# 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: ocelotsocialnetwork/maintenance:local-production
build:
# TODO: Separate from webapp, this must be independent
context: ./webapp
dockerfile: Dockerfile.maintenance
networks:
- external-net
ports:
- 3001:80
########################################################
# NEO4J ################################################
########################################################
neo4j:
image: ocelotsocialnetwork/neo4j-community: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: ocelotsocialnetwork/neo4j-community:local-production
build:
context: ./neo4j
# community edition 👆🏼, because we have no enterprise licence 👇🏼 at the moment
@ -90,19 +111,6 @@ services:
# TODO: clarify if that is the only thing needed to unlock the Enterprise version
# - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
# TODO: Remove the playground from production
########################################################
# MAINTENANCE ##########################################
########################################################
maintenance:
image: ocelotsocialnetwork/maintenance:latest
build:
# TODO: Separate from webapp, this must be independent
context: ./webapp
dockerfile: Dockerfile.maintenance
networks:
- external-net
ports:
- 5000:80
networks:
external-net:

View File

@ -36,4 +36,4 @@ $ docker-compose up
````
And the maintenance mode page or service will be started as well in an own container.
In the browser you can reach it under `http://localhost:5000/`.
In the browser you can reach it under `http://localhost:3001/`.