browsertrix/frontend/Dockerfile
Emma Segal-Grossman 683e531cc0
Localize durations on frontend (#2196)
Partially addresses
https://github.com/webrecorder/browsertrix/issues/2171

- [x] Reimplement `pretty-ms`'s rounding logic to convert to a
`Intl.DurationFormat`-compatible object
- [x] Add `localize.duration` and `localize.humanizeDuration` methods
- [x] Replace `pretty-ms` usage with localized formatting
- [x] Add `Intl.DurationFormat` polyfill
- [x] Update localize tests
- [x] Fix broken tests (thank you @SuaYoo!)
- This looks to be possibly a bug somewhere in the web test runner's
code? Have yet to figure this one out
- Might be related to these:
https://github.com/web-dev-server/web-dev-server/issues/1
https://github.com/guybedford/es-module-lexer/issues/82 — both closed
with no comments or resolution 🙃 — `es-module-lexer` seems to be most
likely, given it's a native module & might be handling unicode sequences
incorrectly or not at all?
- [x] Clean up messy `index.d.ts` — probably split this out? The
definitions haven't yet made their way into `esnext`
https://github.com/microsoft/TypeScript/issues/60608

---------

Co-authored-by: emma-sg <emma-sg@users.noreply.github.com>
Co-authored-by: sua yoo <sua@suayoo.com>
2024-12-03 16:46:57 -05:00

61 lines
1.6 KiB
Docker

# syntax=docker/dockerfile:1.4
FROM --platform=$BUILDPLATFORM docker.io/library/node:18 as build_deps
WORKDIR /app
COPY .yarnrc yarn.lock package.json ./
# Uses a cache mount for the Yarn cache so that it's not included in subsequent steps
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn --production --frozen-lockfile --ignore-optional --network-timeout 1000000
COPY --link config ./config/
COPY --link lit-localize.json \
postcss.config.js \
tailwind.config.js \
tsconfig.json \
webpack.config.js \
webpack.prod.js \
.eslintrc.js \
tsconfig.eslint.json \
index.d.ts \
./
COPY --link lib ./lib/
COPY --link src ./src/
# Build variables used to show current app version
# in the UI. Note that this will invalidate all
# subsequent RUN steps.
ARG GIT_COMMIT_HASH
ARG GIT_BRANCH_NAME
ARG VERSION
ENV GIT_COMMIT_HASH=${GIT_COMMIT_HASH} \
GIT_BRANCH_NAME=${GIT_BRANCH_NAME} \
VERSION=${VERSION}
# Prevent Docker image including node_modules to save space
RUN yarn build && \
rm -rf ./node_modules
FROM --platform=$BUILDPLATFORM docker.io/library/python:3.12-slim as build_docs
WORKDIR /docs
RUN pip install mkdocs-material
COPY --link ./docs/mkdocs.yml .
COPY --link ./docs/docs ./docs
RUN API_DOCS_URL=/api/redoc mkdocs build
FROM docker.io/library/nginx:1.23.2
COPY --link --from=build_deps /app/dist /usr/share/nginx/html
COPY --link --from=build_docs /docs/site /usr/share/nginx/html/docs
#COPY ./nginx.conf /etc/nginx/nginx.conf
COPY --link ./frontend.conf.template /etc/nginx/templates/
COPY --link ./minio.conf /etc/nginx/includes/
ADD --link ./00-browsertrix-nginx-init.sh ./docker-entrypoint.d/