Last active
June 18, 2024 03:43
-
-
Save syntaqx/7e1cd77905214457e25f09331b864680 to your computer and use it in GitHub Desktop.
Simple Node Docker w/ Compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
app: | |
build: . | |
ports: | |
- "3000:3000" | |
environment: | |
NODE_ENV: development | |
DATABASE_URL: postgres://postgres:postgres@postgres/app | |
depends_on: | |
postgres: | |
condition: service_healthy | |
postgres: | |
image: postgres:alpine | |
environment: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: app | |
POSTGRES_HOST_AUTH_METHOD: trust | |
ports: | |
- "5432:5432" | |
volumes: | |
- pg_data:/var/lib/postgresql/data | |
healthcheck: | |
test: ["CMD-SHELL", "pg_isready -U postgres"] | |
interval: 30s | |
timeout: 10s | |
retries: 5 | |
volumes: | |
pg_data: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:latest | |
WORKDIR /usr/src/app | |
COPY package*.json ./ | |
RUN npm install | |
COPY . . | |
EXPOSE 3000 | |
CMD ["npm", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment