Skip to content

Commit

Permalink
Merge pull request #1060 from LEDBrain/dev
Browse files Browse the repository at this point in the history
Fix Docker build
  • Loading branch information
kdev authored May 2, 2024
2 parents 90b0900 + 207377f commit 8a4f8da
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 565 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ jobs:

services:
postgres:
image: postgres:14.2
image: postgres
env:
POSTGRES_USER: ${ PG_USER }
POSTGRES_PASSWORD: ${ PG_PW }
POSTGRES_DB: ${ PG_DB }
POSTGRES_USER: ${{ env.PG_USER }}
POSTGRES_PASSWORD: ${{ env.PG_PW }}
POSTGRES_DB: ${{ env.PG_DB }}
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dist
storage
coverage
.DS_Store
data
2 changes: 1 addition & 1 deletion .labrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
paths: ['dist/api/tests'],
paths: ['dist/src/api/tests'],
reporter: ['console'],
};
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ RUN apt install -y python3 libcurl4-openssl-dev libssl-dev build-essential
RUN npm ci
RUN npm run build

FROM node:20-alpine as cleanup
FROM node:20-slim
WORKDIR /home/node/
COPY --from=build /home/node/package*.json ./
COPY --from=build /home/node/dist ./dist
COPY --from=build /home/node/dist ./
COPY --from=build /home/node/prisma ./prisma
RUN apt update
RUN apt install -y python3 libcurl4-openssl-dev libssl-dev build-essential openssl
RUN npm ci --omit=dev

FROM node:20-alpine
WORKDIR /home/node/
COPY --from=cleanup /home/node/ ./
USER root
# USER root

EXPOSE 3000

Expand All @@ -30,4 +28,4 @@ ENV DATABASE_URL $DATABASE_URL
ENV PORT 3000
ENV HOST $HOSTNAME

CMD npm run migrate:prod && node dist/index.js
CMD npm run migrate:prod && node ./src/index.js
2 changes: 1 addition & 1 deletion build/run-esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as esbuild from 'esbuild';

await esbuild.build({
entryPoints: ['src/**/**.ts'],
outdir: './dist',
outdir: './dist/src',
platform: 'node',
packages: 'external',
format: 'esm',
Expand Down
10 changes: 8 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ version: '3.7'

services:
postgres:
image: postgres:14.2
image: postgres:16
env_file:
- prod.env
volumes:
- ./data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready']
interval: 10s
timeout: 5s
retries: 2

community-service:
build: .
depends_on:
- postgres
postgres:
condition: service_healthy
ports:
- '3000:3000'
env_file:
Expand Down
Loading

0 comments on commit 8a4f8da

Please sign in to comment.