mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-24 12:50:11 +00:00
improve build to install debug tools in testing
This commit is contained in:
parent
59d58f8866
commit
337b373628
@ -25,7 +25,7 @@ This is my setup I have landed on, YMMV:
|
|||||||
```bash
|
```bash
|
||||||
./deploy.sh test
|
./deploy.sh test
|
||||||
```
|
```
|
||||||
- The command above will also copy the file `tubarchivist/testing.sh` into the working folder of the container. Running this script will install additional debugging tools I regularly use in testing.
|
- The command above will call the docker build command with `--build-arg INSTALL_DEBUG=1` to install additional useful debug tools.
|
||||||
- The `test` argument takes another optional argument to build for a specific architecture valid options are: `amd64`, `arm64` and `multi`, default is `amd64`.
|
- The `test` argument takes another optional argument to build for a specific architecture valid options are: `amd64`, `arm64` and `multi`, default is `amd64`.
|
||||||
- This `deploy.sh` file is not meant to be universally usable for every possible environment but could serve as an idea on how to automatically rebuild containers to test changes - customize to your liking.
|
- This `deploy.sh` file is not meant to be universally usable for every possible environment but could serve as an idea on how to automatically rebuild containers to test changes - customize to your liking.
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
FROM python:3.10.2-slim-bullseye
|
FROM python:3.10.2-slim-bullseye
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
ARG INSTALL_DEBUG
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
@ -26,6 +27,13 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \
|
|||||||
apt-get -y update && apt-get -y install --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/* \
|
apt-get -y update && apt-get -y install --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/* \
|
||||||
; fi
|
; fi
|
||||||
|
|
||||||
|
# install debug tools for testing environment
|
||||||
|
RUN if [ "$INSTALL_DEBUG" ] ; then \
|
||||||
|
apt-get -y update && apt-get -y install --no-install-recommends \
|
||||||
|
vim htop bmon net-tools iputils-ping procps \
|
||||||
|
&& pip install --no-cache-dir ipython --src /usr/local/src \
|
||||||
|
; fi
|
||||||
|
|
||||||
# make folders
|
# make folders
|
||||||
RUN mkdir /cache
|
RUN mkdir /cache
|
||||||
RUN mkdir /youtube
|
RUN mkdir /youtube
|
||||||
|
12
deploy.sh
12
deploy.sh
@ -43,7 +43,10 @@ function sync_test {
|
|||||||
# pass argument to build for specific platform
|
# pass argument to build for specific platform
|
||||||
|
|
||||||
host="tubearchivist.local"
|
host="tubearchivist.local"
|
||||||
|
# make base folder
|
||||||
|
ssh "$host" "mkdir -p docker"
|
||||||
|
|
||||||
|
# copy project files to build image
|
||||||
rsync -a --progress --delete-after \
|
rsync -a --progress --delete-after \
|
||||||
--exclude ".git" \
|
--exclude ".git" \
|
||||||
--exclude ".gitignore" \
|
--exclude ".gitignore" \
|
||||||
@ -52,8 +55,8 @@ function sync_test {
|
|||||||
--exclude "db.sqlite3" \
|
--exclude "db.sqlite3" \
|
||||||
. -e ssh "$host":tubearchivist
|
. -e ssh "$host":tubearchivist
|
||||||
|
|
||||||
# uncomment or copy your own docker-compose file
|
# copy default docker-compose file if not exist
|
||||||
# rsync -r --progress --delete docker-compose.yml -e ssh "$host":docker
|
rsync --progress --ignore-existing docker-compose.yml -e ssh "$host":docker
|
||||||
|
|
||||||
if [[ $1 = "amd64" ]]; then
|
if [[ $1 = "amd64" ]]; then
|
||||||
platform="linux/amd64"
|
platform="linux/amd64"
|
||||||
@ -65,12 +68,9 @@ function sync_test {
|
|||||||
platform="linux/amd64"
|
platform="linux/amd64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ssh "$host" "docker buildx build --platform $platform -t bbilly1/tubearchivist:latest tubearchivist --load"
|
ssh "$host" "docker buildx build --build-arg INSTALL_DEBUG=1 --platform $platform -t bbilly1/tubearchivist:latest tubearchivist --load"
|
||||||
ssh "$host" 'docker-compose -f docker/docker-compose.yml up -d'
|
ssh "$host" 'docker-compose -f docker/docker-compose.yml up -d'
|
||||||
|
|
||||||
ssh "$host" 'docker cp tubearchivist/tubearchivist/testing.sh tubearchivist:/app/testing.sh'
|
|
||||||
ssh "$host" 'docker exec tubearchivist chmod +x /app/testing.sh'
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# install debug and testing tools into slim container
|
|
||||||
|
|
||||||
apt update && apt install -y vim htop bmon net-tools iputils-ping procps
|
|
||||||
|
|
||||||
pip install ipython
|
|
||||||
|
|
||||||
##
|
|
||||||
exit 0
|
|
Loading…
Reference in New Issue
Block a user