0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/dev.Dockerfile
Michael Matloka 9f24da6741
Lint Dockerfiles (#3663)
* Lint with Hadolint in Docker test workflow

* Try fixing Hadolint install in workflow

* Try /bin/ instead of /usr/bin/

* Install Hadolint differently

* Install Hadolint differently differently

* Fix Hadolint install properly

* Use chmod +x

* Download Hadolint to workdir

* Update docker-image-test.yml

* Silence curl

* Address production.Dockerfile linter warnings

* Delete obsolete preview.Dockerfile

https://posthog.slack.com/archives/C0113360FFV/p1614948302111800?thread_ts=1614946698.107000&cid=C0113360FFV

* Address dev.Dockerfile linter warning

* Clean up production.Dockerfile
2021-03-18 18:03:42 +01:00

52 lines
1.4 KiB
Docker

FROM python:3.8-slim
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl=7.64.0-4+deb10u1 git=1:2.20.1-2+deb10u3 build-essential=12.6 \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get install -y --no-install-recommends nodejs=14.16.0-1nodesource1 \
&& rm -rf /var/lib/apt/lists/* \
&& npm install -g yarn@1 \
&& yarn config set network-timeout 300000 \
&& yarn --frozen-lockfile
COPY requirements.txt /code/
COPY requirements-dev.txt /code/
# install dependencies but ignore any we don't need for dev environment
RUN pip install -r requirements.txt --no-cache-dir
# install dev dependencies
RUN mkdir /code/requirements/
COPY requirements-dev.txt /code/requirements/
RUN pip install -r requirements-dev.txt --compile --no-cache-dir
COPY package.json /code/
COPY yarn.lock /code/
COPY webpack.config.js /code/
COPY postcss.config.js /code/
COPY babel.config.js /code/
COPY tsconfig.json /code/
COPY .kearc /code/
COPY frontend/ /code/frontend
RUN mkdir /code/plugins
COPY plugins/package.json /code/plugins/
COPY plugins/yarn.lock /code/plugins/
RUN mkdir /code/frontend/dist
COPY . /code/
RUN DEBUG=1 DATABASE_URL='postgres:///' REDIS_URL='redis:///' python manage.py collectstatic --noinput
EXPOSE 8000
EXPOSE 8234
RUN yarn install
RUN yarn install --cwd plugins
ENV DEBUG 1
CMD ["./bin/docker-dev"]