Skip to content

Commit

Permalink
feat(docker): pull and test docker images locally (#2001)
Browse files Browse the repository at this point in the history
Motivation
----------
We push our docker images to Github's container registry here: https://github.com/orgs/dreammall-earth/packages?repo_name=dreammall.earth

With this change, we will be able to pull these images and test them locally.
This speeds up development significantly, especially since on my machine
it takes ages to build `frontend` and `presenter`.

Setting `BREVO` environment variables was necessary so that the backend
server does not terminate immediately.

How to test
-----------
1. From the root directory:
  ```
  echo "IMAGE_TAG=<image_tag>" > .env
  ```
2. `docker compose -f docker-compose.yml pull`
3. Images get downloaded from container registry
  • Loading branch information
roschaefer authored Sep 12, 2024
1 parent e62ba57 commit 9bf092f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IMAGE_TAG=
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ build/
.vscode

.DS_Store

.env
4 changes: 2 additions & 2 deletions authentik/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:
- redis:/data

authentik:
image: ghcr.io/dreammall-earth/dreammall.earth/authentik:latest
image: ghcr.io/dreammall-earth/dreammall.earth/authentik:${IMAGE_TAG:-latest}
build:
context: .
target: production
Expand All @@ -60,7 +60,7 @@ services:
- redis

authentik-worker:
image: ghcr.io/dreammall-earth/dreammall.earth/authentik:latest
image: ghcr.io/dreammall-earth/dreammall.earth/authentik:${IMAGE_TAG:-latest}
build:
context: .
target: production
Expand Down
16 changes: 11 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- db_vol:/var/lib/mysql

presenter:
image: ghcr.io/dreammall-earth/dreammall.earth/presenter:latest
image: ghcr.io/dreammall-earth/dreammall.earth/presenter:${IMAGE_TAG:-latest}
build:
context: ./presenter
target: production
Expand All @@ -30,7 +30,7 @@ services:
- NODE_ENV=production

frontend:
image: ghcr.io/dreammall-earth/dreammall.earth/frontend:latest
image: ghcr.io/dreammall-earth/dreammall.earth/frontend:${IMAGE_TAG:-latest}
build:
context: ./frontend
target: production
Expand All @@ -40,7 +40,7 @@ services:
- NODE_ENV=production

backend:
image: ghcr.io/dreammall-earth/dreammall.earth/backend:latest
image: ghcr.io/dreammall-earth/dreammall.earth/backend:${IMAGE_TAG:-latest}
build:
context: ./backend
target: production
Expand All @@ -51,16 +51,22 @@ services:
condition: service_started
migrations:
condition: service_completed_successfully

ports:
- 4000:4000
environment:
DATABASE_URL: mysql://root:@database:3306/dreammall.earth
JWKS_URI: http://authentik:9000/application/o/dreammallearth/jwks/
NODE_ENV: production
BREVO_KEY: ""
BREVO_ADMIN_NAME: ""
BREVO_ADMIN_EMAIL: ""
BREVO_CONTACT_TEMPLATE_ADMIN: "1"
BREVO_CONTACT_TEMPLATE_USER: "2"
BREVO_NEWSLETTER_TEMPLATE_OPTIN: "3"
BREVO_NEWSLETTER_LIST: "3"

migrations:
image: ghcr.io/dreammall-earth/dreammall.earth/backend:latest
image: ghcr.io/dreammall-earth/dreammall.earth/backend:${IMAGE_TAG:-latest}
command: npm run db:migrate:deploy
build:
context: ./backend
Expand Down

0 comments on commit 9bf092f

Please sign in to comment.