Skip to content
Snippets Groups Projects
Dockerfile 825 B
FROM python:3.10

RUN mkdir /app
WORKDIR /app

RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash -
RUN apt-get install nodejs && rm -rf /var/lib/apt/lists/*

COPY . .

RUN pip install -r requirements/base.txt -r requirements/production.txt
RUN npm install
RUN npm run build

# Placeholder values so the static files collect
RUN DATABASE_URL=postgres://x/x \
    SECRET_KEY=x \
    ALLOWED_HOSTS=x \
    CHOBOTNICE_RV_GID=x \
    INSTAGRAM_CLIENT_ID=x \
    INSTAGRAM_CLIENT_SECRET=x \
    python manage.py collectstatic --noinput --settings=rybicka.settings.production

RUN bash -c "adduser --disabled-login --quiet --gecos app app &&  \
             chmod -R o+r /app/ && \
             chmod o+x /app/run.sh"
USER app

ENV DJANGO_SETTINGS_MODULE "rybicka.settings.production"

EXPOSE 8000

CMD ["bash", "run.sh"]