0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-22 08:40:03 +01:00
posthog/dev.Dockerfile
Tim Glaser bcf427cb55
Webpack HMR, Add hashes to chunk filenames. (#878)
* Closes #877 chunk loading errors

* Closes #877 chunk loading errors

* add chunks to all webpack files, use webpack-html-plugin to make an index.html with the right names

* change to contenthash for better caching

* add dev server on a different port

* store loaded scenes in reducer

* add react-hot-loader

* add react-hot-loader to all code split points

* fix action pages HMR

* ignore cypress screenshots

* generate django login/signup page layout with webpack html plugin

* move to devDependencies

* expose webpack-dev-server ports

* run tests on the production docker image

* start webpack dev server on a custom host if requested

* revert e2e to dev dockerfile

* add test travis config

* add stages

* add travis conf

* cache node and pip

* node 11

* travis ci bump

* node via nvm

* install v12, disable cypress for a moment

* remove 2 commands, test cached build time

* try different yarn cache, add cypress

* add postgres 12

* migrate before cypress

* remove latest postgres for now

* createdb before cypress

* Try different port

* cull packages

* remove hash from main bundle filenames to not break anything

* cypress port 8000

* cypress tests with production docker

* don't use the /code path in e2e test, use docker image

* remove hash from css to work better with editor

* only one export from actions

* remove travis test

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2020-06-02 10:39:53 +01:00

35 lines
969 B
Docker

FROM python:3.8-slim
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
# install dependencies but ignore any we don't need for dev environment
RUN pip install $(grep -ivE "psycopg2" requirements.txt) --compile\
&& pip install psycopg2-binary
COPY package.json /code/
COPY yarn.lock /code/
COPY webpack.config.js /code/
COPY postcss.config.js /code/
COPY .babelrc /code/
COPY frontend/ /code/frontend
RUN apt-get update && apt-get install -y --no-install-recommends curl \
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get install nodejs -y --no-install-recommends \
&& npm install -g yarn@1 \
&& yarn config set network-timeout 300000 \
&& yarn --frozen-lockfile
RUN mkdir /code/frontend/dist
COPY . /code/
RUN DATABASE_URL='postgres:///' REDIS_URL='redis:///' python manage.py collectstatic --noinput
EXPOSE 8000
EXPOSE 8234
RUN yarn install
RUN yarn build
CMD ["./bin/docker-dev"]