-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.test
More file actions
44 lines (35 loc) · 1.33 KB
/
Dockerfile.test
File metadata and controls
44 lines (35 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM node:20-alpine
# Install Postgres Client and Build Tools
RUN apk add --no-cache postgresql-client bash make g++ python3 kubectl
COPY . /app
WORKDIR /app
# Ensure clean slate
RUN rm -rf node_modules
# 3. Configure PNPM Home
ENV PNPM_HOME="/root/.local/share/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
ENV SHELL="/bin/bash"
# 4. Install Dependencies from NPM
RUN npm install -g pnpm@9 && \
pnpm setup && \
pnpm install --no-frozen-lockfile
# 5. Connect to global (not needed for pnpm v9+)
# RUN pnpm route-global
# 6. Install PGPM from NPM
RUN pnpm add -g pgpm
# Run as postgres user to avoid 'role root does not exist' in pgsql-test
# handle existing user/group if created by apk
RUN (getent group postgres || addgroup -S postgres) && (getent passwd postgres || adduser -S postgres -G postgres)
RUN chown -R postgres:postgres /app
USER postgres
ENV USER=postgres
ENV PGUSER=postgres
# 6. Setup Entrypoint (Inlined for Minimalism)
ENV NODE_ENV=test
CMD ["/bin/bash", "-c", "set -e; \
echo \"Waiting for Postgres at $PGHOST:$PGPORT...\"; \
until pg_isready -h \"$PGHOST\" -p \"$PGPORT\" -U \"$PGUSER\"; do echo \"Waiting...\"; sleep 2; done; \
echo \"Deploying Schema...\"; \
pgpm deploy --package pgpm-database-jobs --database template1 --yes 2>/dev/null || echo \"Deploy continued...\"; \
unset PGDATABASE; \
pnpm test"]