Skip to content

Commit cda747d

Browse files
feat: add prod docker compose
1 parent 0188620 commit cda747d

9 files changed

+145
-79
lines changed

.dockerignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
sample.env
2+
.env
3+
README.md
4+
eslint.config.js
5+
.github
6+
docs
7+
node_modules
8+
tests

Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
ARG NODE_VERSION=20.16.0
2+
3+
FROM node:${NODE_VERSION}-alpine as builder
4+
WORKDIR /app
5+
6+
# Download dependencies as a separate step to take advantage of Docker's caching.
7+
# Leverage a cache mount to /root/.npm to speed up subsequent builds.
8+
# Leverage a bind mounts to package.json and package-lock.json to avoid having to copy them into
9+
# into this layer.
10+
RUN --mount=type=bind,source=package.json,target=package.json \
11+
--mount=type=bind,source=package-lock.json,target=package-lock.json \
12+
--mount=type=cache,target=/root/.npm \
13+
npm ci
14+
15+
COPY . .
16+
17+
FROM node:${NODE_VERSION}-alpine
18+
19+
WORKDIR /app
20+
USER node
21+
22+
COPY --from=builder /app .
23+
24+
ARG PORT=4000
25+
ENV PORT $PORT
26+
EXPOSE $PORT

compose.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ services:
99
POSTGRES_DB: ucpa_facilitator
1010
env_file:
1111
- .env
12+
13+
chrome:
14+
image: ghcr.io/browserless/chromium
15+
container_name: chrome
16+
ports:
17+
- '3000:3000'

config.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function getParsedJson(environmentVariable) {
1515
function buildConfiguration() {
1616
const config = {
1717
environment: env.NODE_ENV || 'development',
18-
port: env.PORT || 3000,
18+
port: env.PORT || 4000,
1919
baseURL: env.BASE_URL || 'http://example.net',
2020
secret: env.SECRET,
2121
logging: {
@@ -60,6 +60,9 @@ function buildConfiguration() {
6060
passTypeIdentifier: env.PASS_TYPE_IDENTIFIER,
6161
teamIdentifier: env.PASS_TEAM_IDENTIFIER,
6262
},
63+
browser: {
64+
browserWSEndpoint: env.BROWSER_WS_ENDPOINT,
65+
},
6366
};
6467
if (config.environment === 'test') {
6568
config.logging.enabled = false;

0 commit comments

Comments
 (0)