Skip to content

Commit

Permalink
Merge pull request #633 from nhost/docker-restructure
Browse files Browse the repository at this point in the history
Docker restructure + simple contributing guide
  • Loading branch information
Johan Eliasson authored Jul 16, 2021
2 parents 3380745 + 6c5d9db commit 3ce57d5
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 83 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,7 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: nhost/hasura-backend-plus
path: .
dockerfile: docker/prod/Dockerfile
tag_with_ref: true
tag_with_sha: true
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributing to Hasura Backend Plus

## Dependencies

- [Yarn](https://classic.yarnpkg.com/en/docs/install/#mac-stable)
- [Docker](https://www.docker.com/)
- [Docker Compose](https://docs.docker.com/compose/)

## Get Started

1. [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repository to your own GitHub account and then [clone](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository) it to your local device.
2. Create a new branch: `git checkout -b MY_BRANCH_NAME`
3. Install the dependencies: `yarn`
4. Run `yarn dev` to build and watch for code changes
35 changes: 0 additions & 35 deletions Dockerfile.dev

This file was deleted.

44 changes: 0 additions & 44 deletions docker-compose.yaml

This file was deleted.

22 changes: 22 additions & 0 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:14-alpine

RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh

ARG NODE_ENV=development
ENV NODE_ENV $NODE_ENV
ENV PORT 3000

ENV PGOPTIONS "-c search_path=auth"

WORKDIR /app

# needed for jest --watch to work properly
RUN git init /app

COPY package.json yarn.lock ./
RUN yarn install

COPY ../../ .

CMD ["yarn", "run", "dev:in-docker"]
2 changes: 1 addition & 1 deletion docker/dev/docker-compose-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
image: 'nhost/hasura-backend-plus:latest'
container_name: hbp-dev-hbp
build:
context: ../../
context: .
dockerfile: Dockerfile.dev
depends_on:
- graphql-engine
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile → docker/prod/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM node:14-alpine AS builder
WORKDIR /app
COPY . .
COPY package.json yarn.lock ./
RUN yarn install
COPY . .
RUN yarn build

FROM node:14-alpine
Expand All @@ -14,8 +14,7 @@ ENV PGOPTIONS "-c search_path=auth"

WORKDIR /app

COPY package.json yarn.lock ./
RUN yarn install && yarn cache clean
COPY package.json .

COPY --from=builder /app/dist/ dist/
COPY custom custom
Expand Down

0 comments on commit 3ce57d5

Please sign in to comment.