Files
Anthias/docker/Dockerfile.server.j2

51 lines
1.1 KiB
Django/Jinja

{% if environment == 'production' %}
FROM debian:bookworm AS node-builder
RUN \
apt-get update && \
apt-get -y install --no-install-recommends \
nodejs \
npm
RUN mkdir -p /app
WORKDIR /app
COPY package.json \
package-lock.json \
webpack.prod.js \
webpack.common.js \
/app/
RUN npm install
COPY ./static/js/*.coffee /app/static/js/
COPY ./static/sass/*.scss /app/static/sass/
RUN npm run build
{% endif %}
{% include 'Dockerfile.base.j2' %}
COPY requirements/requirements.txt /tmp/requirements.txt
{% if disable_cache_mounts %}
RUN \
{% else %}
RUN --mount=type=cache,target=/root/.cache/pip \
{% endif %}
pip3 install -r /tmp/requirements.txt --break-system-packages
RUN mkdir -p /usr/src/app
COPY . /usr/src/app/
WORKDIR /usr/src/app
{% if environment == 'production' %}
COPY --from=node-builder \
/app/static/dist/ \
/usr/src/app/static/dist/
{% endif %}
ENV GIT_HASH={{ git_hash }}
ENV GIT_SHORT_HASH={{ git_short_hash }}
ENV GIT_BRANCH={{ git_branch }}
ENV DEVICE_TYPE={{ board }}
CMD ["bash", "bin/start_server.sh"]