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
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.7
~> 3.3
46 changes: 41 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,58 @@
FROM registry.access.redhat.com/ubi8/ruby-31
FROM ruby:3.3-slim AS base
USER root

# Configure users and groups
RUN groupadd -g 40054 alma && \
useradd -r -s /sbin/nologin -M -u 40054 -g alma alma && \
useradd -u 40061 bfs && \
groupadd -g 40061 bfs && \
usermod -u 40061 -g bfs -G alma -l bfs default && \
find / -user 1001 -exec chown -h bfs {} \; || true && \
mkdir -p /opt/app && \
chown -R bfs:bfs /opt/app

# Get list of available packages
RUN apt-get -y update -qq

COPY --chown=bfs . /opt/app

ENTRYPOINT ["/opt/app/bin/bfs"]
CMD ["help"]

# ===============================================
# Target: development
# ===============================================

FROM base AS development

USER root

RUN apt-get -y --no-install-recommends install \
build-essential \
make

USER bfs

# Base image ships with an older version of bundler
RUN gem install bundler --version 2.5.22

WORKDIR /opt/app
COPY --chown=bfs Gemfile* .ruby-version ./
RUN bundle config set force_ruby_platform true
RUN bundle config set system 'true'
RUN bundle install
COPY --chown=bfs . .

USER bfs
ENTRYPOINT ["/opt/app/bin/bfs"]
CMD ["help"]
# COPY --chown=bfs:bfs . .

# =================================
# Target: production
# =================================
FROM base AS production

# Copy the built codebase from the dev stage
# COPY --from=development --chown=bfs /opt/app /opt/app
COPY --from=development --chown=bfs /usr/local/bundle /usr/local/bundle

WORKDIR /opt/app
RUN bundle config set frozen 'true'
RUN bundle install --local
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ gem 'net-ssh', '~> 7.1.0'
gem 'nokogiri', '~> 1.15.0'
gem 'rspec'
gem 'thor', '~> 1.1'


14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ docker compose build
View the CLI tool help/description:

```sh
docker compose run --rm bfs help
docker compose run --rm app help
```

Adds test data to the default watch directory:

```sh
docker compose run --rm bfs seed
docker compose run --rm app seed
```

Run the app in the background. It will continue running, monitoring for .xml files to process every 10s.
Expand All @@ -32,19 +32,19 @@ docker compose logs -f # view processing logs in real time
Watch a non-standard directory:

```sh
docker compose run --rm bfs watch /path/in/container # absolute path
docker compose run --rm bfs watch data/somedir # path relative to /opt/app-root/src
docker compose run --rm app watch /path/in/container # absolute path
docker compose run --rm app watch data/somedir # path relative to /opt/app
```

Process a specific file:

```sh
docker compose run --rm bfs process /abs/path/to/myfile.xml # absolute path
docker compose run --rm bfs process data/invoicing/pay/somefile.xml # relative path
docker compose run --rm app process /abs/path/to/myfile.xml # absolute path
docker compose run --rm app process data/invoicing/pay/somefile.xml # relative path
```

Delete previously processed files and error logs:

```sh
docker compose run --rm bfs clear
docker compose run --rm app clear
```
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
app:
build: .
build:
context: .
target: development
command: watch --interval 10
init: true
environment:
Expand Down