Skip to content

Commit 465918d

Browse files
authored
Repo tweaks (#261)
1 parent 24a5a0a commit 465918d

File tree

3 files changed

+20
-29
lines changed

3 files changed

+20
-29
lines changed

.github/workflows/test.yml

-12
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,6 @@ jobs:
3939
with:
4040
bundler-cache: true
4141

42-
- name: Find yarn cache location
43-
id: yarn-cache
44-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
45-
46-
- name: JS package cache
47-
uses: actions/cache@v4
48-
with:
49-
path: ${{ steps.yarn-cache.outputs.dir }}
50-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
51-
restore-keys: |
52-
${{ runner.os }}-yarn-
53-
5442
- name: Install packages
5543
run: |
5644
yarn install --frozen-lockfile

Dockerfile

+13-17
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
# Build builder image
2-
FROM ruby:3.3.4-alpine as builder
2+
FROM ruby:3.3.4-alpine as base
33

44
WORKDIR /app
55

6+
# tzdata: required to set timezone
7+
RUN apk --no-cache add \
8+
tzdata \
9+
postgresql-client
10+
11+
# Ensure latest rubygems is installed
12+
RUN gem update --system
13+
614
# Install dependencies
715
RUN apk --no-cache add \
816
ruby-dev \
917
build-base \
1018
postgresql-dev \
11-
tzdata \
1219
yarn
1320

1421
# Copy required files
@@ -35,16 +42,7 @@ RUN rm -rf node_modules log/* tmp/* /tmp && \
3542
rm -rf /usr/local/bundle/cache
3643

3744
# Build runtime image
38-
FROM ruby:3.3.4-alpine
39-
40-
# The application runs from /app
41-
WORKDIR /app
42-
43-
# libpq: required to run postgres, tzdata: required to set timezone
44-
RUN apk --no-cache add \
45-
libpq \
46-
tzdata \
47-
postgresql-client
45+
FROM base
4846

4947
# Add non-root user and group with alpine first available uid, 1000
5048
RUN addgroup -g 1000 -S appgroup && \
@@ -56,16 +54,14 @@ COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
5654

5755
# Create log and tmp
5856
RUN mkdir -p log tmp
59-
RUN chown -R appuser:appgroup db log tmp
57+
RUN chown -R appuser:appgroup ./*
6058

6159
# Set user
6260
USER 1000
6361

6462
ARG APP_BUILD_DATE
65-
ENV APP_BUILD_DATE ${APP_BUILD_DATE}
66-
6763
ARG APP_BUILD_TAG
68-
ENV APP_BUILD_TAG ${APP_BUILD_TAG}
69-
7064
ARG APP_GIT_COMMIT
65+
ENV APP_BUILD_DATE ${APP_BUILD_DATE}
66+
ENV APP_BUILD_TAG ${APP_BUILD_TAG}
7167
ENV APP_GIT_COMMIT ${APP_GIT_COMMIT}

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ Use the dev command to run the application. This will use Foreman to start the r
7979
$ bin/dev
8080
```
8181

82+
#### Running tests
83+
84+
```
85+
$ bundle exec rspec
86+
```
87+
88+
8289
## Admin
8390
The admin area is accessed via the path '/admin'.
8491
In production this is restricted to a set of allowed IP addresses which are stored in a secret in a semicolon delimited list.

0 commit comments

Comments
 (0)