0.4.0
This commit is contained in:
parent
6b2c4996d5
commit
8e7b059ad3
97 changed files with 15077 additions and 6892 deletions
108
docker/django
108
docker/django
|
|
@ -1,10 +1,108 @@
|
|||
FROM python:3.7-buster
|
||||
# stage 1
|
||||
FROM python:3.9-bullseye as backend
|
||||
|
||||
RUN pip install poetry
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
vim \
|
||||
curl \
|
||||
gettext \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
COPY poetry.lock pyproject.toml /app/
|
||||
RUN mkdir /app/src
|
||||
RUN mkdir /app/logs
|
||||
RUN mkdir /app/media
|
||||
|
||||
RUN poetry config virtualenvs.create false && poetry install --no-interaction --extras sentry
|
||||
COPY ./requirements /app/requirements
|
||||
|
||||
COPY . /app/
|
||||
RUN pip install -r requirements/base.txt
|
||||
|
||||
|
||||
# stage 2
|
||||
FROM node:16-bullseye AS frontend-build
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./*.json ./*.js ./.babelrc /app/
|
||||
|
||||
RUN npm ci
|
||||
|
||||
COPY ./src /app/src
|
||||
|
||||
RUN npm run build
|
||||
|
||||
|
||||
# stage 3
|
||||
FROM python:3.9-bullseye as production
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
postgresql-client \
|
||||
vim \
|
||||
curl \
|
||||
gettext \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN mkdir /app/logs
|
||||
RUN mkdir /app/media
|
||||
RUN mkdir /app/bin
|
||||
|
||||
COPY --from=backend /usr/local/lib/python3.9 /usr/local/lib/python3.9
|
||||
COPY --from=backend /usr/local/bin/celery /usr/local/bin/celery
|
||||
|
||||
COPY ./bin/docker-entrypoint.sh /app/bin/docker-entrypoint.sh
|
||||
|
||||
COPY --from=frontend-build /app/src/newsreader/static /app/src/newsreader/static
|
||||
|
||||
COPY ./src /app/src
|
||||
|
||||
COPY ./requirements /app/requirements
|
||||
|
||||
RUN pip install -r requirements/production.txt
|
||||
|
||||
RUN useradd -M -u 1000 newsreader
|
||||
RUN chown -R newsreader:newsreader /app
|
||||
|
||||
USER newsreader
|
||||
|
||||
ARG POSTGRES_HOST
|
||||
ARG POSTGRES_PORT
|
||||
ARG POSTGRES_DB
|
||||
ARG POSTGRES_USER
|
||||
ARG POSTGRES_PASSWORD
|
||||
ARG DJANGO_SECRET_KEY
|
||||
ARG DJANGO_SETTINGS_MODULE
|
||||
|
||||
RUN python src/manage.py collectstatic --noinput
|
||||
|
||||
|
||||
# (optional) stage 4
|
||||
FROM python:3.9-bullseye as development
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
vim \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN mkdir /app/logs
|
||||
RUN mkdir /app/media
|
||||
RUN mkdir /app/bin
|
||||
|
||||
COPY ./requirements /app/requirements
|
||||
COPY ./bin/docker-entrypoint.sh /app/bin/docker-entrypoint.sh
|
||||
COPY --from=backend /usr/local/lib/python3.9 /usr/local/lib/python3.9
|
||||
COPY --from=backend /usr/local/bin/celery /usr/local/bin/celery
|
||||
COPY --from=backend /app/src/ /app/src/
|
||||
|
||||
RUN pip install -r requirements/development.txt
|
||||
|
||||
RUN useradd -M -u 1000 newsreader
|
||||
RUN chown -R newsreader:newsreader /app
|
||||
|
||||
USER newsreader
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
FROM node:12
|
||||
FROM node:16-bullseye
|
||||
|
||||
WORKDIR /app
|
||||
RUN mkdir /app/src
|
||||
|
||||
COPY package.json package-lock.json /app/
|
||||
COPY package*.json webpack.*.js .babelrc /app/
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY . /app/
|
||||
COPY ./src /app/src
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue