Skip to content

Commit b2eb957

Browse files
committed
Slim working image
Signed-off-by: SeeuSim <[email protected]>
1 parent 250c446 commit b2eb957

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

backend/user/entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ npm run db:prod:migrate
66
# Checks admin table and will not seed if data exists
77
npm run db:prod:seed
88

9+
rm -rf drizzle src tsconfig.json
10+
11+
npm uninstall tsx drizzle-kit
12+
913
npm run start

backend/user/express.Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ RUN npm run build
99
FROM node:lts-alpine AS production
1010
WORKDIR /data/user-express
1111
COPY --from=build /data/user-express/package*.json ./
12-
RUN npm ci --omit=dev
1312
COPY --from=build --chown=node:node /data/user-express/dist ./dist
1413

14+
RUN npm ci --omit=dev
15+
# For migration
16+
RUN npm install tsx drizzle-kit
17+
COPY drizzle ./drizzle
18+
COPY src/lib/db/ ./src/lib/db
19+
COPY src/lib/passwords ./src/lib/passwords
20+
COPY src/config.ts ./src
21+
COPY tsconfig.json .
22+
COPY entrypoint.sh .
23+
1524
ARG port
1625
EXPOSE ${port}
1726
CMD [ "npm", "run", "start" ]

docker-compose.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ services:
7070
container_name: "user-express"
7171
build:
7272
context: ./backend/user
73-
dockerfile: ./express.Dockerfile
74-
target: build
73+
dockerfile: express.Dockerfile
74+
target: production
7575
args:
7676
# For building with the correct env vars
7777
- env=${USER_EXPRESS_ENV}
@@ -92,6 +92,12 @@ services:
9292
- user-db-network
9393
- user-api-network
9494
entrypoint: ["/bin/sh", "entrypoint.sh"]
95+
healthcheck:
96+
test: wget --no-verbose --tries=1 --spider http://localhost:9001/health || exit 1
97+
interval: 30s
98+
timeout: 10s
99+
retries: 5
100+
start_period: 5s
95101

96102
volumes:
97103
# Persistent Volumes for Databases

0 commit comments

Comments
 (0)