Skip to content

Commit

Permalink
Fix container image build (#178)
Browse files Browse the repository at this point in the history
Fixes #177
Use python:3.9-alpine as base to reduce reliance on alpine maintainers
for python and remove already provided packages (python3, python3-dev,
ca-certificates).
Remove bash since there is already a shell provided and the
entrypoint-script is not using bash-exclusive syntax.
Change entrypoint-script's shebang from bash to sh & fix
array-to-string assignment see https://github.com/koalaman/shellcheck/wiki/SC2124
  • Loading branch information
nunico authored May 20, 2021
1 parent 74a43be commit 01acaf2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
16 changes: 7 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
FROM alpine:3.8

RUN set -x && \
apk add --no-cache bash python3 ca-certificates postgresql-libs postgresql-dev && \
apk add --no-cache --virtual=build-dependencies build-base python3-dev && \
pip3 install --upgrade --no-cache-dir pip && \
pip3 install --no-cache-dir psycopg2-binary migra && \
apk del build-dependencies postgresql-dev python3-dev && \
rm -rf /tmp/* /var/tmp/* /var/cache/apk/*
FROM python:3.9-alpine

RUN apk add --update --no-cache --upgrade postgresql-libs && \
apk add --no-cache --virtual=build-dependencies build-base postgresql-dev && \
pip install --no-cache-dir packaging psycopg2-binary migra && \
apk del build-dependencies && \
rm -rf /tmp/* /var/tmp/* /var/cache/apk/*

COPY docker-entrypoint.sh /docker-entrypoint.sh

Expand Down
5 changes: 2 additions & 3 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

set -e

if [ "$1" = 'migra' ]; then
if [ "${MIGRA_LOG_COMMAND}" = 'true' ]; then
migra_command="$@"
echo "${migra_command}"
echo "$*"
fi
fi

Expand Down

0 comments on commit 01acaf2

Please sign in to comment.