Skip to content

Commit

Permalink
[REFACTORING] Improve Docker use (hedyorg#4064)
Browse files Browse the repository at this point in the history
Some minor improvements for the use of Docker in development.

Changes:
- Adds build-essentials to the image, this is needed for some npm packages 
- Decrease the amount of RUN layers to reduce image size
- Improve documentation a bit
  • Loading branch information
ToniSkulj authored Mar 1, 2023
1 parent 12a5e50 commit 7ffe62a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
12 changes: 8 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,21 @@ Don't worry if you make a mistake here, the files are always generated again on
## Using Docker
If you want to run the website locally, but would prefer to use Docker instead
of installing python, you can build a container image and run it like so:
If you want to run the website locally and would prefer to use Docker you can build a container with:
```bash
docker build -t hedy .
```

and then:
and then you can run the docker container with:

```bash
docker run -it --rm -p 8080:8080 --mount type=bind,source="$(pwd)",target=/app hedy
docker run -it --rm -p 8080:8080 --mount type=bind,source="$(pwd)",target=/app --name hedy hedy
```

After that, you can access bash inside the container with:
```bash
docker exec -it hedy bash
```

## Testing Admin facing features locally
Expand Down
15 changes: 6 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
FROM python:3.9-slim

RUN apt update && apt install -y gcc

COPY requirements.txt /tmp/requirements.txt

RUN pip3 install --no-cache-dir -r /tmp/requirements.txt

RUN apt install -y curl && curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && apt-get install -y nodejs
RUN apt update && \
apt install build-essential -y && \
apt install -y curl && \
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
apt-get install -y nodejs && \
pip3 install --no-cache-dir -r /tmp/requirements.txt

WORKDIR /app

COPY . .

EXPOSE 8080

ENTRYPOINT ["python", "app.py"]

0 comments on commit 7ffe62a

Please sign in to comment.