Skip to content

Instantly share code, notes, and snippets.

@masterxavierfox
Last active May 25, 2020 18:19
Show Gist options
  • Select an option

  • Save masterxavierfox/070745c36346ddee9bbc7d42c6549558 to your computer and use it in GitHub Desktop.

Select an option

Save masterxavierfox/070745c36346ddee9bbc7d42c6549558 to your computer and use it in GitHub Desktop.

Revisions

  1. masterxavierfox revised this gist May 25, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ services:
    - postgres

    frontend:
    image: masterfox/demo:backend
    image: masterfox/demo:frontend
    ports:
    - 3000:3000
    depends_on:
  2. masterxavierfox revised this gist May 25, 2020. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -22,4 +22,11 @@ services:
    ports:
    - 3001:3001
    depends_on:
    - postgres
    - postgres

    frontend:
    image: masterfox/demo:backend
    ports:
    - 3000:3000
    depends_on:
    - backend
  3. masterxavierfox revised this gist May 25, 2020. 3 changed files with 18 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion .dockerignore - backend
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    PGDATA
    node_modules
    npm-debug.log
    npm-debug.log
    .dockerignore
    Dockerfile
    4 changes: 4 additions & 0 deletions .dockerignore - frontend
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    .dockerignore
    Dockerfile
    node_modules
    build
    11 changes: 11 additions & 0 deletions Dockerfile - frontend
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    FROM node:10
    ENV PORT 3000
    EXPOSE 3000

    RUN mkdir -p /usr/src/app
    WORKDIR /usr/src/app
    COPY package.json .
    RUN yarn install
    COPY . .

    CMD ["yarn", "start"]
  4. masterxavierfox created this gist May 25, 2020.
    3 changes: 3 additions & 0 deletions .dockerignore - backend
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    PGDATA
    node_modules
    npm-debug.log
    17 changes: 17 additions & 0 deletions Dockerfile.backend
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@

    FROM golang:1.12.0
    RUN apt-get update
    RUN apt-get install -y git python jq curl
    RUN curl -sL https://deb.nodesource.com/setup_9.x | bash -
    RUN apt-get update && apt-get install -y nodejs
    RUN go get -u github.com/pressly/goose/cmd/goose


    RUN mkdir -p /apps/backend
    WORKDIR /app/backend
    COPY . .
    RUN npm install --silent
    RUN npm install -g gulp-cli && npm install [email protected]
    COPY . .
    RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && chmod +x wait-for-it.sh
    ENTRYPOINT ./wait-for-it.sh postgres:5432 -- goose postgres "postgres://postgres:password@postgres:5432/ictlife_infra_interview_may_2020" status && gulp server
    25 changes: 25 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    version: '3.7'

    services:
    postgres:
    image: kartoza/postgis:12.0
    ports:
    - 5432:5432
    volumes:
    - $PWD/PGDATA:/var/lib/postgresql/12/main
    environment:
    - POSTGRES_USER=postgres
    - PGUSER=postgres
    - POSTGRES_PASS=password
    - PGPASSWORD=password
    - POSTGRES_DBNAME=ictlife_infra_interview_may_2020
    - PGDATABASE=ictlife_infra_interview_may_2020
    - PGHOST=localhost
    - ALLOW_IP_RANGE=0.0.0.0/0

    backend:
    image: masterfox/demo:backend
    ports:
    - 3001:3001
    depends_on:
    - postgres