Skip to content

Commit

Permalink
dockerization for production done
Browse files Browse the repository at this point in the history
  • Loading branch information
Andyccs committed Dec 30, 2015
1 parent 9336bd8 commit ea2af13
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 9 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ To run stylechecker:
```Shell
cd stylechecker
docker build -t my-sqat-stylechecker .
docker run --name -p 50051:50051 stylechecker my-sqat-stylechecker &
docker run --name stylechecker -p 50051:50051 my-sqat-stylechecker &
```

To run website:

```Shell
# You must be in root directory
cp website/Dockerfile . && \
docker build -t my-sqat . && \
rm Dockerfile
docker run --name -p 4000:4000 sqatwebsite my-sqat-website &
cp website/.dockerignore . && \
docker build -t my-sqat-website . && \
rm Dockerfile && \
rm .dockerignore
docker run --name sqatwebsite --link stylechecker:stylechecker -p 4000:4000 my-sqat-website &
```

Next, check your docker machine ip address by using:
Expand Down
75 changes: 75 additions & 0 deletions website/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# You must be in the root directory of this project when building this image
website/.eslintrc
website/.nvmrc

# Ignore .git folder
.git*

# Created by https://www.gitignore.io/api/windows,linux,osx,vim

### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk


### Linux ###
*~

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*


### OSX ###
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### Vim ###
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
5 changes: 2 additions & 3 deletions website/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# You must be in the root directory of this project when building this image

FROM andyccs/sqat-website:0.1.0
MAINTAINER Andyccs <andychong2@gmail.com>

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY . /usr/src/app
COPY stylechecker/src/main/proto/ /usr/src/app/stylechecker/src/main/proto/
COPY website/ /usr/src/app/website
WORKDIR /usr/src/app/website
RUN npm install
RUN npm install grpc@${GRPC_NODE_VERSION}
Expand All @@ -15,7 +15,6 @@ RUN npm run deploy
ENV NODE_ENV=production
ENV PORT=4000

#CMD [ "/bin/bash" ]
CMD [ "/usr/local/bin/node", "./backend/babel_index.js" ]
ENTRYPOINT [ "/usr/local/bin/node", "./backend/babel_index.js" ]

Expand Down
4 changes: 2 additions & 2 deletions website/backend/submitSourceCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export default function submitSourceCode(request, response) {
let sourceCode = request.body.sourceCode;

let client = new styleCheckProto.StyleCheck(
'localhost:50051',
grpc.Credentials.createFake());
'stylechecker:50051',
grpc.Credentials.createInsecure());

let configuration =
'{"methodNameFormat": "camelCase","wildCardImport": "noWildCard","braceStyle":"kr"}';
Expand Down

0 comments on commit ea2af13

Please sign in to comment.