Skip to content

Instantly share code, notes, and snippets.

@nsisodiya
Created May 18, 2017 14:10
Show Gist options
  • Select an option

  • Save nsisodiya/fa70793e6dcc2dff1e216611d07137ef to your computer and use it in GitHub Desktop.

Select an option

Save nsisodiya/fa70793e6dcc2dff1e216611d07137ef to your computer and use it in GitHub Desktop.
docker-compose for node alpine with Yarn + postgresql db
POSTGRES_DB=xyzdb
POSTGRES_USER=xyzuser
POSTGRES_PASSWORD=xyzpassword
#!/usr/bin/env bash
POSTGRES_DB=xyzdb
POSTGRES_USER=xyzuser
export PGPASSWORD=xyzpassword
pg_dump -h localhost -U $POSTGRES_USER $POSTGRES_DB > dump.sql
POSTGRES_DB=xyzodb
POSTGRES_USER=xyzuser
export PGPASSWORD=xyzpassword
dropdb -U $POSTGRES_USER -e --if-exists $POSTGRES_DB
createdb -U $POSTGRES_USER $POSTGRES_DB
cat ./dump.sql | psql -U $POSTGRES_USER --dbname=$POSTGRES_DB
version: '3'
volumes:
# We'll define a volume that will store the data from the postgres databases:
postgres-data:
driver: local
services:
billexo-graphql-server:
build: .
tty: true
stdin_open: true
links:
- "billexo-db-server:billexodbserver"
volumes:
- ./:/billexo-graphql-server
ports:
- "3000:3000"
billexo-db-server:
image: postgres
env_file:
- database-variables.env
volumes:
- postgres-data:/var/lib/postgresql/data
- ./db:/root/db
ports:
- "5432:5432"
FROM node:7.10.0-alpine
RUN apk add --update curl
RUN apk add --update tar
RUN rm -rf /var/cache/apk/*
RUN curl -o- -L https://yarnpkg.com/install.sh | /bin/sh
WORKDIR /billexo-graphql-server
CMD ["/bin/sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment