1
0
Fork 0
mirror of https://github.com/kou029w/quot.git synced 2025-01-18 16:08:03 +00:00

use supervisor

This commit is contained in:
Nebel 2022-08-28 22:00:21 +09:00
parent 34d4d46372
commit 8756685659
8 changed files with 33 additions and 23 deletions

3
.gitignore vendored
View file

@ -1 +1,2 @@
.env **/.*
**/node_modules

13
Dockerfile Normal file
View file

@ -0,0 +1,13 @@
FROM postgrest/postgrest:v10.0.0 AS api
FROM amacneil/dbmate:1.15 AS dbmate
FROM node:18.7.0-alpine
RUN apk add --no-cache supervisor
COPY --from=api /bin/postgrest /usr/bin/
COPY --from=dbmate /usr/local/bin/dbmate /usr/bin/
COPY ./db ./db
COPY ./app ./app
RUN npm --prefix app ci --production
COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
COPY ./supervisord.conf /
CMD ["supervisord", "-c", "/supervisord.conf"]

1
app/.gitignore vendored
View file

@ -1 +0,0 @@
node_modules

View file

@ -1,5 +0,0 @@
FROM node:18.7.0-alpine
WORKDIR /app
COPY . /app
RUN npm ci --production
CMD ["npm", "start"]

View file

@ -1,29 +1,18 @@
services: services:
app: quot:
image: kou029w/quot-app image: kou029w/quot
build: app build: "."
restart: unless-stopped restart: unless-stopped
init: true
user: ${UID:-1000}:${GID:-1000}
ports: ["8080:8080"] ports: ["8080:8080"]
volumes:
- ./app:/app
environment:
QUOT_API_URL: http://api:3000/
depends_on: [api]
api:
image: postgrest/postgrest:v10.0.0
restart: unless-stopped
environment: environment:
PGRST_DB_URI: postgresql://postgres:${POSTGRES_PASSWORD}@/postgres?host=/var/run/postgresql PGRST_DB_URI: postgresql://postgres:${POSTGRES_PASSWORD}@/postgres?host=/var/run/postgresql
PGRST_DB_SCHEMA: public PGRST_DB_SCHEMA: public
PGRST_DB_ANON_ROLE: postgres PGRST_DB_ANON_ROLE: postgres
volumes: volumes:
- postgres_socket:/var/run/postgresql - postgres_socket:/var/run/postgresql
depends_on: depends_on: [db]
db:
condition: service_healthy
dbmate: dbmate:
profiles: [dev]
image: amacneil/dbmate:1.15 image: amacneil/dbmate:1.15
command: --wait up command: --wait up
user: ${UID:-1000}:${GID:-1000} user: ${UID:-1000}:${GID:-1000}

4
docker-entrypoint.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
set -e
dbmate --url "${PGRST_DB_URI}" --wait up
exec "$@"

9
supervisord.conf Normal file
View file

@ -0,0 +1,9 @@
[supervisord]
nodaemon = true
user = root
[program:app]
command = npm --prefix app start
[program:api]
command = postgrest