Skip to content

Commit 8cf6411

Browse files
committed
Working more-or-less
1 parent a8aff6d commit 8cf6411

19 files changed

+1527
-706
lines changed

.dockerignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
dist
2+
Dockerfile
3+
.dockerignore
4+
.editorconfig
5+
*.env
6+
.git
7+
.github
8+
.gitignore
9+
*.md
10+
*.sh
11+
*.tmp
12+
tmp*

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
indent_size = 4
10+
indent_style = space
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.yaml]
15+
indent_size = 2
16+
17+
[*.json]
18+
indent_size = 2

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
.idea/
1+
dist
2+
.DS_Store
3+
*.env*
4+
*.log
5+
node_modules/
6+
*.tgz
7+
*.tmp
8+
tmp*

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@jsr:registry=https://npm.jsr.io

Dockerfile

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,46 @@
1-
FROM ubuntu:latest
2-
MAINTAINER Andrew Marcuse "fileformat@gmail.com"
3-
4-
RUN apt-get update -y && \
5-
apt-get install -y python-pip python-psycopg2 postgresql
6-
7-
RUN pip install WebOb Paste webapp2
8-
9-
COPY . /app
10-
11-
RUN \
12-
service postgresql start && \
13-
su postgres -c "createuser --superuser root" && \
14-
psql --echo-queries --dbname=postgres --file=/app/dbinit.sql
15-
16-
# createdb rxp_db && \
17-
# psql --echo-queries --dbname=rxp_db --file=/app/dbinit.sql
18-
19-
ENV DATABASE_URL=postgresql://rxp_user:secret@localhost:5432/rxp_db
1+
# syntax=docker/dockerfile:1.7-labs
2+
FROM node:22-bookworm AS base
3+
4+
WORKDIR /app
5+
6+
USER root
7+
8+
RUN apt-get update && \
9+
apt-get install -y dumb-init
10+
11+
COPY package.json package-lock.json /app/
12+
RUN npm install --audit=false --fund=false --omit dev
13+
14+
15+
#
16+
# build the app
17+
#
18+
FROM base AS builder
19+
20+
COPY . /app/
21+
22+
RUN npm install --audit=false --fund=false
23+
RUN npm run build
24+
25+
#
26+
# runner
27+
#
28+
FROM gcr.io/distroless/nodejs22-debian12:latest AS runner
29+
30+
ARG COMMIT="(not set)"
31+
ARG LASTMOD="(not set)"
2032
ENV COMMIT=$COMMIT
2133
ENV LASTMOD=$LASTMOD
34+
ENV NODE_ENV=production
35+
36+
USER nonroot
37+
COPY --chown=nonroot:nonroot --from=base /usr/bin/dumb-init /usr/bin/dumb-init
38+
COPY --chown=nonroot:nonroot --from=base /app/node_modules /app/node_modules
39+
COPY --chown=nonroot:nonroot --from=builder /app/dist /app/dist
40+
COPY --chown=nonroot:nonroot --exclude=src . /app
2241

2342
WORKDIR /app
24-
CMD ./server.sh
43+
ENV PORT 5000
44+
ENV HOSTNAME 0.0.0.0
45+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
46+
CMD ["/nodejs/bin/node", "dist/server.js"]

LICENSE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,8 @@ to attach them to the start of each source file to most effectively
629629
state the exclusion of warranty; and each file should have at least
630630
the "copyright" line and a pointer to where the full notice is found.
631631

632-
<one line to give the program's name and a brief idea of what it does.>
633-
Copyright (C) <year> <name of author>
632+
regexplanet-postgresql - testing regular expressions in PostgreSQL
633+
Copyright (C) 2024 Andrew Marcuse
634634

635635
This program is free software: you can redistribute it and/or modify
636636
it under the terms of the GNU Affero General Public License as published by

dbinit.sql

Lines changed: 0 additions & 32 deletions
This file was deleted.

deploy.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

docker-run.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
#!/bin/bash
22

3+
set -o errexit
4+
set -o pipefail
5+
set -o nounset
6+
7+
APP_NAME=$(jq --raw-output .name package.json)
8+
9+
docker build \
10+
--build-arg COMMIT=$(git rev-parse --short HEAD) \
11+
--build-arg LASTMOD=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
12+
--progress plain \
13+
--tag "${APP_NAME}" \
14+
.
15+
16+
echo "INFO: running"
17+
docker run \
18+
--env PORT=4000 \
19+
--expose 4000 \
20+
--interactive \
21+
--name "${APP_NAME}" \
22+
--publish 4000:4000 \
23+
--rm \
24+
--tty \
25+
"${APP_NAME}"
326

4-
docker build -t regexplanet-postgresql .
5-
docker run -p 4000:4000 --expose 4000 -e PORT='4000' regexplanet-postgresql

favicon.ico

-87.9 KB
Binary file not shown.

favicon.svg

Lines changed: 0 additions & 271 deletions
This file was deleted.

0 commit comments

Comments
 (0)