-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from ShipChain/feature/docker-image-cleanup
Docker Build Improvements
- Loading branch information
Showing
65 changed files
with
1,521 additions
and
1,515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
node_modules | ||
# Directories | ||
# ----------- | ||
.circleci | ||
.git | ||
.githooks | ||
.idea | ||
bin | ||
compose/nginx | ||
node_modules | ||
reports | ||
|
||
|
||
# Specific Files | ||
# -------------- | ||
compose/*.yml | ||
.dockerignore | ||
.env* | ||
*Dockerfile* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__tests__ | ||
src/entity/migration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "./tsconfig.json", | ||
"ecmaVersion": 6, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"modules": true | ||
} | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
// "rules": { | ||
// "@typescript-eslint/indent": "error", | ||
// "@typescript-eslint/camelcase": "error", | ||
// "@typescript-eslint/no-unused-vars": "warn", | ||
// "@typescript-eslint/no-var-requires": "off", | ||
// "@typescript-eslint/explicit-function-return-type": "error" | ||
// }, | ||
"extends": ["plugin:prettier/recommended"] | ||
// "extends": ["plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
BRANCH=`git rev-parse --abbrev-ref HEAD` | ||
|
||
if [[ "$BRANCH" == "master" ]]; then | ||
bin/docker_tests | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__tests__ | ||
src/entity/migration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# test directories | ||
__tests__ | ||
test | ||
tests | ||
powered-test | ||
|
||
# asset directories | ||
docs | ||
doc | ||
website | ||
images | ||
|
||
# examples | ||
example | ||
examples | ||
|
||
# code coverage directories | ||
coverage | ||
.nyc_output | ||
|
||
# build scripts | ||
Makefile | ||
Gulpfile.js | ||
Gruntfile.js | ||
|
||
# configs | ||
appveyor.yml | ||
circle.yml | ||
codeship-services.yml | ||
codeship-steps.yml | ||
wercker.yml | ||
.tern-project | ||
.gitattributes | ||
.editorconfig | ||
.*ignore | ||
.eslintrc | ||
.jshintrc | ||
.flowconfig | ||
.documentup.json | ||
.yarn-metadata.json | ||
.travis.yml | ||
|
||
# misc | ||
*.md | ||
|
||
# remove aws-sdk from winston-cloudwatch. It's already included in this project and isn't yet a peer dependency in that package | ||
winston-cloudwatch/node_modules/aws-sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,87 @@ | ||
FROM node:10.14.0-stretch | ||
## Base image with node and entrypoint scripts ## | ||
## =========================================== ## | ||
FROM node:10.15.0-alpine AS base | ||
|
||
LABEL maintainer="Lucas Clay <[email protected]>" | ||
|
||
ENV LANG C.UTF-8 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# SUPPORT SSH FOR IAM USERS # | ||
RUN apt-get update && apt-get -y install openssh-server python3-pip jq | ||
RUN mkdir /var/run/sshd /etc/cron.d | ||
RUN pip3 install keymaker | ||
RUN keymaker install | ||
|
||
# Configure public key SSH | ||
RUN echo "AllowAgentForwarding yes" >> /etc/ssh/sshd_config | ||
RUN echo "PasswordAuthentication no" >> /etc/ssh/sshd_config | ||
# ------------------------- # | ||
|
||
RUN pip3 install awscli | ||
RUN apk add --no-cache bash | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
|
||
ADD ./package.json /app/ | ||
ADD ./yarn.lock /app/ | ||
RUN yarn | ||
|
||
COPY . /app/ | ||
|
||
COPY ./compose/scripts/*.sh / | ||
RUN chmod +x /*.sh | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
|
||
## Image with system dependencies for building ## | ||
## =========================================== ## | ||
FROM base AS build | ||
|
||
RUN apk add --no-cache \ | ||
libc6-compat \ | ||
# git, python, make, g++ are for installing/building several npm modules | ||
git \ | ||
python \ | ||
make \ | ||
g++ | ||
|
||
|
||
## Image with dev-dependencies ## | ||
## =========================== ## | ||
FROM build AS test | ||
|
||
COPY package.json /app/ | ||
COPY yarn.lock /app/ | ||
COPY .yarnclean /app/ | ||
|
||
RUN yarn --frozen-lockfile && yarn cache clean | ||
|
||
COPY . /app/ | ||
|
||
|
||
## Image only used for production building ## | ||
## ======================================= ## | ||
FROM build AS prod | ||
|
||
COPY package.json /app/ | ||
COPY yarn.lock /app/ | ||
COPY .yarnclean /app/ | ||
|
||
RUN yarn --prod --frozen-lockfile && yarn cache clean | ||
|
||
COPY . /app/ | ||
|
||
|
||
## Image to be deployed to ECS with additional utils and no build tools ## | ||
## ==================================================================== ## | ||
FROM base AS deploy | ||
|
||
# Install openssh for ECS management container | ||
RUN apk add --no-cache \ | ||
openssh-server-pam \ | ||
python3 \ | ||
jq \ | ||
openssl \ | ||
shadow \ | ||
nano | ||
|
||
RUN mkdir /var/run/sshd /etc/cron.d && touch /etc/pam.d/sshd | ||
RUN sed -i 's/^CREATE_MAIL_SPOOL=yes/CREATE_MAIL_SPOOL=no/' /etc/default/useradd | ||
|
||
# Keymaker for SSH auth via IAM | ||
RUN pip3 install \ | ||
keymaker==1.0.8 \ | ||
awscli==1.16.95 && \ | ||
rm -rf /root/.cache/* | ||
|
||
# Configure public key SSH | ||
RUN echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config | ||
RUN echo "UsePAM yes" >> /etc/ssh/sshd_config | ||
RUN echo "AllowAgentForwarding yes" >> /etc/ssh/sshd_config | ||
RUN echo "PasswordAuthentication no" >> /etc/ssh/sshd_config | ||
|
||
# Copy production node_modules without having to install packages in build | ||
COPY --from=prod /app /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.