Skip to content

Commit

Permalink
🐛 Fix issues related to building docker images.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwir3 committed Apr 10, 2022
1 parent c58c634 commit 0964586
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARCHETYPE_MODE=development
MYSQL_DATABASE="archetype_${ARCHETYPE_MODE}"
MYSQL_USER=archetype_admin
MYSQL_PASSWORD=somearchetypepassword
MYSQL_ROOT_PASSWORD=somerootpassword
DATABASE_URL="mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@localhost/${MYSQL_DATABASE}"
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,27 @@ export DATABASE_URL=mysql://archetype:<password>@0.0.0.0:3307/archetype_producti
3. Use `cargo` to build and run:
```bash
cargo run
```
```

# Docker Image Maintenance
This is a note for maintainers of the docker image [jwir3/archetype_web](https://hub.docker.com/r/jwir3/archetype_web/tags).
You probably don't need to worry about this.

In order to build the docker image, we need to set up a "dummy" `.env` file with some basic environment variables in it.
These can be overridden by the user when the download/run the image, but the build will fail without _something_ there.

**Note**: We should fix this so that it doesn't just _terminate the build_ if a `.env` file is not found.

Once you've made code changes that constitute the update(s) you want to make to the image in question, simply run the
command:
```
docker-compose -f docker-compose.yml --env-file <dummy_env_file or test env_file> up
```

Next, verify that the service is working as you expect (unless you built with a dummy `.env` file, in which case you
likely will not be able to check).

Next, tag the image for docker:
```
```
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
networks:
- archetype_net
env_file:
- .env
- .env.test
ports:
# Use port 3307 on the host machine so as not to interfere with another mysql server already running
- "3307:3306"
Expand Down Expand Up @@ -37,4 +37,4 @@ networks:
archetype_net:
driver: bridge
volumes:
db_data:
db_data:
1 change: 1 addition & 0 deletions docker/Dockerfile.web
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ WORKDIR /usr/src/archetype

COPY . .

RUN cargo --version
RUN cargo install --path .
RUN cargo install diesel_cli
#RUN cargo build --release
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(decl_macro)]
#![feature(decl_macro, const_fn_trait_bound)]
#[macro_use] extern crate diesel;
#[macro_use] extern crate rocket;
#[macro_use] extern crate serde;
Expand Down

0 comments on commit 0964586

Please sign in to comment.