Docker image, & local development docker-compose.yml #2

Merged
3wordchant merged 12 commits from docker into master 2021-07-21 23:18:11 +00:00
3 changed files with 22 additions and 7 deletions
Showing only changes of commit 67149f437a - Show all commits

View File

@ -1,8 +1,17 @@
FROM python:3.8-alpine as build
RUN apk add gettext git gcc python3-dev musl-dev \
libffi-dev zlib-dev jpeg-dev libjpeg postgresql-dev build-base \
--virtual .build-dependencies
RUN apk add --no-cache \
3wordchant marked this conversation as resolved Outdated

Feel free to ignore but I usually add --no-cache to save space and newline + sort things so it is easier to have a visual overview of dependencies and alphabetic ordering to know where to slot things in. Can be useful if you end up adding a lot of dependencies and then need to remove them over time as the software changes.

RUN apk add --no-cache \
    build-base \
    gcc \
    gettext \
    git \
    jpeg-dev \
    libffi-dev \
    libjpeg \
    musl-dev \
    postgresql-dev \
    python3-dev \
    zlib-dev \
    --virtual .build-dependencies
Feel free to ignore but I usually add `--no-cache` to save space and newline + sort things so it is easier to have a visual overview of dependencies and alphabetic ordering to know where to slot things in. Can be useful if you end up adding a lot of dependencies and then need to remove them over time as the software changes. ``` RUN apk add --no-cache \ build-base \ gcc \ gettext \ git \ jpeg-dev \ libffi-dev \ libjpeg \ musl-dev \ postgresql-dev \ python3-dev \ zlib-dev \ --virtual .build-dependencies ```
build-base \
gcc \
gettext \
git \
jpeg-dev \
libffi-dev \
libjpeg \
musl-dev \
postgresql-dev \
python3-dev \
zlib-dev
RUN mkdir -p /app/{code,venv}
WORKDIR /app/code
@ -17,8 +26,14 @@ RUN pipenv install --deploy --verbose
FROM python:3.8-alpine
RUN apk add --no-cache libpq libstdc++ libjpeg virt-install libvirt-client \
cloud-utils openssh-client
RUN apk add --no-cache \
cloud-utils \
libjpeg \
libpq \
libstdc++ \
libvirt-client \
openssh-client \
virt-install
COPY . /app/code/
WORKDIR /app/code

View File

@ -33,7 +33,7 @@ for var_name in [
"SPOKE_HOST_TOKEN", "HUB_TOKEN", "STRIPE_SECRET_KEY",
"BTCPAY_PRIVATE_KEY", "MAIL_PASSWORD"
]:
var = os.environ.get(f"{var_name}_FILE", False)
var = os.environ.get(f"{var_name}_FILE")
3wordchant marked this conversation as resolved Outdated

Optional: var = os.environ.get(f"{var_name}_FILE") also works as it defaults to None if missing.

Optional: `var = os.environ.get(f"{var_name}_FILE")` also works as it defaults to `None` if missing.
if not var:
continue

View File

@ -26,7 +26,7 @@ services:
devices:
- "/dev/kvm:/dev/kvm"
db:
image: "postgres:9.6.5"
image: "postgres:9.6.5-alpine"
3wordchant marked this conversation as resolved Outdated
Maybe `postgres:9.6-alpine` as it is smaller? https://hub.docker.com/_/postgres?tab=description&page=1&ordering=last_updated
volumes:
- "postgres:/var/lib/postgresql/data"
environment: