Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
################################################################################
# Node Assets
################################################################################
FROM node:25.9.0@sha256:c69f4e0640e5b065f2694579793e4309f1e0e49868b0f2fea29c44d9c0dc2caf AS assets

# Use non-root "app" user in directory /app
ARG UID=1000
ARG GID=1000

RUN groupadd -g ${GID} -o app
RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash app

USER app

WORKDIR /app

# Install packages
COPY package.json package-lock.json ./
RUN npm ci

COPY eslint.config.js ./
COPY ./assets ./assets
COPY ./test ./test

RUN npm run build

################################################################################
# BASE
################################################################################
FROM ruby:4.0-slim AS base

ARG UID=1000
ARG GID=1000
ARG NODE_MAJOR=20


RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
build-essential \
Expand All @@ -18,13 +42,6 @@ RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
git


RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends nodejs

RUN npm install -g npm

RUN groupadd -g ${GID} -o app
RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash app

Expand Down Expand Up @@ -70,6 +87,5 @@ USER app

RUN bundle install

RUN npm ci
RUN npm run build

COPY --chown=${UID}:{GID} --from=assets /app/public/scripts /app/public/scripts
COPY --chown=${UID}:{GID} --from=assets /app/public/styles /app/public/styles
4 changes: 2 additions & 2 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ services:
js:
build:
context: .
target: development
target: assets
args:
UID: ${UID:-1000}
GID: ${GID:-1000}
Expand All @@ -133,7 +133,7 @@ services:
css:
build:
context: .
target: development
target: assets
args:
UID: ${UID:-1000}
GID: ${GID:-1000}
Expand Down
7 changes: 5 additions & 2 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ fi
echo "🚢 Build docker images"
docker compose build

echo "⬇️ Pull dependent service images"
docker compose pull

echo "📦 Installing Gems"
docker compose run --rm app bundle

echo "📦 Installing Node modules"
docker compose run --rm web npm install
docker compose run --rm js npm install

echo "📦 Building js and css"
docker compose run --rm web npm run build
docker compose run --rm js npm run build
Loading