-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(dev): option for setting service image and volume names (#2288)
* custom db preparation - add optional var RAKE_DB_MIGRATE to run db:migrate instead of db:setup - also prevent multiple `yarn install` * devcontainer - avoid overwriting .env copy compose files and env variable to .devcontainer and keep .env if present untouched as it was originaly for the rails app (dotenv) * env var to set volume names, app or db images: set env variables in the docker-compose.dev.yml to allow using - prebuild images for the app and skip the building process - distinct postgres images - distinct named volume for the db and homedir(asdf, gems, etc) remove image tags from dev docker compose file by yml overwrite for devcontainer build to avoid retagging the images * set a .dockerenv.example that can be used instead of .env to have a better separation of variable for the configuring the docker env and variables to be used insides the services * vscode tasks to up/down with .dockerenv
- Loading branch information
Showing
11 changed files
with
202 additions
and
27 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
x-common-volumes: | ||
- &vhome homedir:/home/chemotion-dev | ||
- &vapp ..:/home/chemotion-dev/app | ||
|
||
|
||
services: | ||
app: | ||
build: | ||
context: '.' | ||
dockerfile: 'Dockerfile.chemotion-dev' | ||
# args: | ||
# source_image: ${DOCKER_DEV_IMAGE:-ubuntu:jammy} # Build ARG for base image | ||
# FULL_BUILD: ${FULL_BUILD:-false} | ||
image: "" | ||
volumes: | ||
- *vhome | ||
- *vapp | ||
webpacker: | ||
build: | ||
context: '.' | ||
dockerfile: 'Dockerfile.chemotion-dev' | ||
# args: | ||
# source_image: ${DOCKER_DEV_IMAGE:-ubuntu:jammy} # Build ARG for base image | ||
# FULL_BUILD: ${FULL_BUILD:-false} | ||
image: "" | ||
volumes: | ||
- *vhome | ||
- *vapp |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## Environment variables for docker-compose.dev.yml | ||
## Copy this file to .dockerenv and adjust the values | ||
## Do not commit .dockerenv to the repository | ||
## `docker compose --env-file .dockerenv -f docker-compose.dev.yml config` | ||
## will use the values from this file | ||
## - DOCKER_PG_IMAGE: the image to use as base for the db container | ||
## - DOCKER_DEV_IMAGE: the image to use as base for the app and webpacker containers | ||
## overwriten to '' when using vs decontainer.json to avoid tag conflicts | ||
## Latest available version: https://hub.docker.com/u/complat/dev/tags | ||
## app image with preinstalled asdf plugins(ruby, nodejs), gems and nodejs packages | ||
|
||
DOCKER_DEV_IMAGE=complat/dev:v1.10.3-37-ga95534401 | ||
#DOCKER_PG_IMAGE=postgres:16 | ||
|
||
## - VOLUME_NAME_HOMEDIR: Use another named volume for homedir (asdf, gems, etc) | ||
## - VOLUME_NAME_DB: or database | ||
|
||
#VOLUME_NAME_HOMEDIR=chemotion_eln_homedir2 | ||
#VOLUME_NAME_DB=chemotion_eln_database2 | ||
|
||
## ENV for the app container | ||
## - RAKE_DB_MIGRATE: use by prepare sh to run db migration (rake db:migrate) | ||
## when starting the app container {always, once, never} | ||
## always: run db migration on every start | ||
## once: run db migration only once after the db is created | ||
## never: never run db migration on start | ||
RAKE_DB_MIGRATE=once | ||
|
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,5 +24,4 @@ fi | |
|
||
echo '>>> Installing JS packages...' | ||
yarn install --production=false | ||
yarn install | ||
|
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
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