Skip to content

Commit

Permalink
Update dockerfile build
Browse files Browse the repository at this point in the history
- update stages since bower isn't working properly
  • Loading branch information
tudoramariei committed Dec 27, 2023
1 parent d25eee5 commit 5311b69
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions docker/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
FROM node:18.17.1-bookworm-slim as frontend
FROM node:18.17.1-bookworm as frontend

WORKDIR /var/www/redirect/build
COPY ./backend/ .
# set up a user and group for bower since it's not working as root
ARG USER=builduser
ARG GROUP=${USER}
ARG UID=10000
ARG GID=10000

RUN groupadd --gid ${GID} --non-unique ${GROUP} && \
useradd --create-home --shell /bin/bash --uid ${UID} --gid ${GID} --non-unique ${USER}

USER ${USER}


WORKDIR /home/${USER}/redirect/build
ENV PATH /home/${USER}/redirect/build/node_modules/.bin:$PATH

# install the frontend libraries:
RUN npm install -g npm bower && \
bower install --allow-root --config.interactive=false
COPY ./backend/package.json ./backend/package-lock.json ./backend/bower.json ./backend/.bowerrc ./
RUN npm cache clean --force && npm ci && bower install


FROM python:3.11.7-slim-bookworm as backend
FROM python:3.11.7-bookworm as backend

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
gettext git gcc g++ && \
gettext && \
python3 -m pip install --upgrade pip setuptools cython

# Python virtualenv paths
Expand Down Expand Up @@ -50,7 +63,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
nginx gcc xz-utils gettext
nginx gcc xz-utils gettext

# configure process manager
ARG S6_OVERLAY_VERSION=3.1.2.1
Expand All @@ -74,7 +87,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
COPY --from=backend "${VIRTUAL_ENV}" "${VIRTUAL_ENV}"
COPY ./backend/ /var/www/redirect/backend/

COPY --from=frontend /var/www/redirect/build/bower_components/ /var/www/redirect/backend/bower_components/
COPY --from=frontend /home/builduser/redirect/build/bower_components/ /var/www/redirect/backend/bower_components/

# activate the virtualenv:
RUN . "${VIRTUAL_ENV}/bin/activate"
Expand Down

0 comments on commit 5311b69

Please sign in to comment.