Search code examples
pythondockergccargon

Install argon2 in Docker image (problem with installing gcc)


right now I'm trying to setup argon2 in a docker image. Apparently I have to install gcc before (and I don't just want to install it on my local machine). My Dockerfile looks like this:

FROM python:3.6-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY requirements.txt /usr/src/app/
RUN apt install -y gcc && \
pip3 install --no-cache-dir -r requirements.txt
COPY . /usr/src/app
EXPOSE 8080
ENTRYPOINT ["python3"]
CMD ["argon.py"]

and my requirements.txt look like this:

flask
flask_restful
connexion == 2.2.0
python_dateutil == 2.6.0
setuptools >= 21.0.0
swagger-ui-bundle
argon2-cffi

When I try to build my docker container like this I get an error: "/bin/sh: apt: not found"

I'm trying this on ubuntu server 18.04 if this is relevant.


Solution

  • Like Klaus D. said, I had to use apk instead of apt. Also I had to install some more dependencies than only gcc. So my Dockerfile looks like this now:

    RUN apk add gcc musl-dev libffi-dev && \
        pip install -U  cffi pip setuptools && \
        pip3 install --no-cache-dir -r requirements.txt
    

    This solved my problem and let me use argon2d.