0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-30 19:41:46 +01:00
posthog/production.Dockerfile
Adrien Brault 864dd60a18
Make docker apt version pinning less strict (#3889)
* Make docker apt version pinning less strict

* Single quote versioned apt-get install packages

Co-authored-by: Michael Matloka <dev@twixes.com>
2021-04-07 12:51:34 +02:00

40 lines
1.4 KiB
Docker

FROM python:3.8-slim
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY . /code/
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update \
&& apt-get install -y --no-install-recommends 'curl=7.*' 'git=1:2.*' 'build-essential=12.6' \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get install -y --no-install-recommends 'nodejs=14.*' \
&& npm install -g yarn@1 \
&& yarn config set network-timeout 300000 \
&& yarn --frozen-lockfile \
&& yarn build \
&& yarn --cwd plugins --frozen-lockfile --ignore-optional \
&& yarn cache clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf node_modules
# install dependencies but ignore any we don't need for dev environment
RUN pip install -r requirements.txt --no-cache-dir --compile \
&& pip uninstall ipython-genutils pip -y
RUN SECRET_KEY='unsafe secret key for collectstatic only' DATABASE_URL='postgres:///' REDIS_URL='redis:///' python manage.py collectstatic --noinput
RUN apt-get purge -y git curl build-essential && apt-get autoremove -y
# add posthog user, move runtime files into home and change permissions
# this alleviates compliance issue for not running a container as root
RUN useradd -m posthog && mv /code /home/posthog && chown -R posthog:1000 /home/posthog/code
WORKDIR /home/posthog/code
USER posthog
EXPOSE 8000
CMD ["./bin/docker"]