Skip to content

Commit

Permalink
Update Dockerfile, docker-compose.yml and add .dockerignore so builds…
Browse files Browse the repository at this point in the history
… are now self-contained, update README.md
  • Loading branch information
leeallen337 committed Apr 27, 2017
1 parent 6ffee4d commit 770d96b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
.git/
.gitignore
README.md
29 changes: 21 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
FROM node:6
# Use the slim version of the latest Node LTS which includes Yarn
FROM node:6.10.2-slim

RUN apt-get update
RUN apt-get install apt-transport-https
# Docker images have no default editor so we'll use vim
RUN apt-get update && apt-get install -y \
vim

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

RUN apt-get update
RUN apt-get install yarn
# Create an app directory for our app to exist in the docker container
RUN mkdir -p app

# Establish a directory where later commands will be run relative to in the container
WORKDIR /app

# Copy package.json & yarn.lock into our app directory in the container
COPY package.json \
yarn.lock \
# Destination folder
/app/

# Install dependencies in the container
RUN yarn install

# Copy all the rest of our files into the app directory in the container
COPY . /app

# Expose port for webpack
EXPOSE 8080
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ git push origin master

## Commands

Run your tests with:
```
yarn test
```
Run the server with:
```
yarn start
```

Run your tests with:
```
yarn test
```

Run a build with:
```
yarn build
Expand All @@ -50,7 +52,7 @@ yarn build

Build and start the server:
```
docker-compose up
docker-compose up --build
```

Run your tests with:
Expand All @@ -62,3 +64,8 @@ Run a build with:
```
docker-compose exec web yarn build
```

If your terminal closes run:
```
docker-compose logs --follow
```
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ services:
web:
tty: true
build: .
command: bash -c "yarn && yarn start"
command: 'yarn start'
ports:
- '8080:8080'
- "8080:8080"
volumes:
- .:/app:rw
- .:/app

0 comments on commit 770d96b

Please sign in to comment.