Skip to content

Commit

Permalink
build(node): update node version to lts/iron and update related depen…
Browse files Browse the repository at this point in the history
…dancy
  • Loading branch information
rockleona committed Jun 4, 2024
1 parent 03d3e8a commit 249df13
Show file tree
Hide file tree
Showing 7 changed files with 4,229 additions and 19 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ jobs:
run: |
poetry install
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 8

- name: Setup Yarn install
uses: borales/actions-yarn@v4
with:
cmd: install
node-version: '20.x'

- name: install via yarn2
run: |
yarn install --immutable
- name: Run ruff on src
run: |
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/carbon
lts/iron
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# [Node Stage to get node_modolues and node dependencies]
FROM node:8.16.0-buster-slim as node_base
FROM node:20.11.0-bullseye-slim as node_base
# [Python Stage for Django web server]
FROM python:3.10.14-slim-bullseye as python_base

FROM node_base as node_deps
COPY ./yarn.lock yarn.lock
COPY ./package.json package.json

RUN apt-get update
RUN apt-get install python-pip -y

RUN npm install -g yarn
RUN yarn install --dev --frozen-lockfile && yarn cache clean
RUN corepack enable
RUN yarn install --immutable

FROM python_base as python_deps
ENV APP_DIR /usr/local/app

# make nodejs accessible and executable globally
ENV NODE_PATH $APP_DIR/node_modules/
ENV PATH /usr/local/bin:$PATH

# Add bin directory used by `pip install --user`
ENV PATH /home/docker/.local/bin:$PATH

# Infrastructure tools
# gettext is used for django to compile .po to .mo files.
RUN apt-get update
Expand Down
49 changes: 49 additions & 0 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# [Node Stage to get node_modolues and node dependencies]
FROM node:20.11.0-bullseye as node_stage

COPY ./yarn.lock yarn.lock
COPY ./package.json package.json

RUN corepack enable
RUN yarn install --immutable

# [Python Stage for Django web server]
FROM python:3.10.14-slim-bullseye as python_stage

WORKDIR /app

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1

# Infrastructure tools
# gettext is used for django to compile .po to .mo files.
RUN apt-get update
RUN apt-get install -y \
libpq-dev \
gcc \
zlib1g-dev \
libjpeg62-turbo-dev \
mime-support \
gettext \
libxml2-dev \
libxslt-dev

# Install Poetry
RUN pip install --no-cache-dir pip==23.3.2 && \
pip install --no-cache-dir poetry==1.8.2

# Install Python dependencies
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-root && \
yes | poetry cache clear --all pypi

# Add poetry bin directory to PATH
ENV PATH="${WORKDIR}/.venv/bin:$PATH"

COPY --from=node_stage /node_modules ./node_modules
COPY --from=node_stage /usr/local/bin/node /usr/local/bin/node
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-transform-class-properties": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"autoprefixer": "^8.0.0",
"autoprefixer": "^10.4.19",
"babelify": "^10.0.0",
"browserify": "^16.1.0",
"node-sass": "^4.9.0",
"postcss-cli": "^5.0.0"
"browserify": "^17.0.0",
"node-sass": "^9.0.0",
"postcss": "^8.4.38",
"postcss-cli": "^11.0.0"
},
"dependencies": {
"blueimp-gallery": "^2.44.0",
Expand Down
2 changes: 1 addition & 1 deletion src/pycontw2016/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def node_bin(name):
COMPRESS_SCSS_COMPILER_CMD = (
'{node_sass_bin} --include --output-style expanded {paths} '
'--include-path="{node_modules}" "{infile}" "{outfile}" && '
'{postcss_bin} --use "{node_modules}/autoprefixer" '
'{postcss_bin} --use "{node_modules}/autoprefixer/lib/autoprefixer.js" '
'--autoprefixer.browsers "{autoprefixer_browsers}" -r "{outfile}"'
)

Expand Down
Loading

0 comments on commit 249df13

Please sign in to comment.