Skip to content

Commit

Permalink
Move Docker container configuration to compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Jbsco committed Jun 21, 2024
1 parent fd60485 commit 231e718
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This procedure is used to create a new Docker container that hosts the Adamant b
$ git clone https://github.com/lasp/adamant.git
```

3. Next, tell Docker to create a new container from the [pre-built image](https://github.com/lasp/adamant/pkgs/container/adamant). This make take a few minutes and ~3 GB of disk space. By default, the container created is named `adamant_container`. To change this, or the image that the container uses, modify `docker_config.sh` before running the commands below.
3. Next, tell Docker to create a new container from the [pre-built image](https://github.com/lasp/adamant/pkgs/container/adamant). This make take a few minutes and ~3 GB of disk space. By default, the container created is named `adamant_container`. To change this, or the image that the container uses, modify `compose.yml` before running the commands below.

```
$ cd adamant/docker
Expand Down Expand Up @@ -77,4 +77,4 @@ Next, you can create the Docker image by running:
$ ./adamant_env.sh build
```

This may take several minutes complete. By default, the image created is named `ghcr.io/lasp/adamant:latest`. To change this, modify `docker_config.sh` before running `./adamant_env.sh build`.
This may take several minutes complete. By default, the image created is named `ghcr.io/lasp/adamant:latest`. To change this, modify `compose.yml` before running `./adamant_env.sh build`.
9 changes: 7 additions & 2 deletions docker/adamant_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ fi

set -e

. ${this_dir}/docker_config.sh
PROJECT_NAME=${this_dir%/*}
PROJECT_NAME=${PROJECT_NAME##*/}
DOCKER_COMPOSE_COMMAND="docker compose"
Expand All @@ -32,6 +31,12 @@ if [ "$?" -ne 0 ]; then
export DOCKER_COMPOSE_COMMAND="docker-compose"
fi

# Helper function to print out command as executed:
execute () {
echo "$ $@"
eval "$@"
}

usage() {
echo "Usage: $1 [start, stop, login, push, build, remove]" >&2
echo "* start: create and start the ${PROJECT_NAME} container" >&2
Expand All @@ -45,7 +50,7 @@ usage() {

case $1 in
start )
execute "${DOCKER_COMPOSE_COMMAND} -f ${DOCKER_COMPOSE_CONFIG} up -d"
execute "${DOCKER_COMPOSE_COMMAND} -f ${DOCKER_COMPOSE_CONFIG} up --pull \"missing\" -d"
execute "${DOCKER_COMPOSE_COMMAND} -f ${DOCKER_COMPOSE_CONFIG} exec ${PROJECT_NAME} bash -c \"\
if [ ! -f /home/user/.initialized ]; \
then source /home/user/adamant/env/activate && touch /home/user/.initialized; \
Expand Down
4 changes: 2 additions & 2 deletions docker/compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: adamant
services:
adamant:
container_name: ${DOCKER_CONTAINER_NAME}
container_name: adamant_container
volumes:
- type: bind
source: ../../adamant
target: /home/user/adamant
extra_hosts:
- host.docker.internal:host-gateway
network_mode: host
image: ${DOCKER_IMAGE_NAME}
image: ghcr.io/lasp/adamant:latest
build:
context: .
command: sleep infinity
12 changes: 0 additions & 12 deletions docker/docker_config.sh

This file was deleted.

0 comments on commit 231e718

Please sign in to comment.