Skip to content

Commit

Permalink
merged aws-test with testapi
Browse files Browse the repository at this point in the history
  • Loading branch information
lzy7071 committed Jun 5, 2020
2 parents b711e0b + da1785d commit fd2014a
Show file tree
Hide file tree
Showing 7 changed files with 1,293 additions and 76 deletions.
25 changes: 9 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,21 @@ workflows:
- Frontend Integration Test:
requires:
- Build
- Deploy:
- aws-ecr/build-and-push-image: # push image to ECR
requires:
- Unit Test
- Validation Test
- Implementation Test
- Backend Integration Test
- Frontend Integration Test
# - aws-ecr/build-and-push-image: # push image to ECR
# requires:
# - Unit Test
# - Validation Test
# - Implementation Test
# - Backend Integration Test
# - Frontend Integration Test
# repo: "${AWS_RESOURCE_NAME_PREFIX}"
# tag: "${CIRCLE_SHA1}"
# - aws-ecs/deploy-service-update: # update ECS
# requires:
# - aws-ecr/build-and-push-image
# family: "${AWS_RESOURCE_NAME_PREFIX}-service"
# cluster-name: "${AWS_RESOURCE_NAME_PREFIX}-cluster"
# container-image-name-updates: "container=${AWS_RESOURCE_NAME_PREFIX}-service,tag=${CIRCLE_SHA1}"
repo: "${AWS_RESOURCE_NAME_PREFIX_TEST}"
tag: "${CIRCLE_SHA1}"
- aws-ecs/deploy-service-update: # update ECS
requires:
- aws-ecr/build-and-push-image
family: "${AWS_RESOURCE_NAME_PREFIX_TEST}-service"
cluster-name: "${AWS_RESOURCE_NAME_PREFIX_TEST}-cluster"
container-image-name-updates: "container=${AWS_RESOURCE_NAME_PREFIX_TEST}-service,image-and-tag=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${AWS_RESOURCE_NAME_PREFIX_TEST}:${CIRCLE_SHA1}"
KarrLab:
jobs:
- karrlab
Expand Down
61 changes: 33 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,51 @@
FROM python:3.7-slim-buster

WORKDIR /ecs

COPY ./nginx/install-nginx.sh .

RUN bash install-nginx.sh

COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
# RUN apt-get update \
# && apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates git

EXPOSE 80
EXPOSE 443
EXPOSE 8080
COPY ./nginx/default.conf /etc/nginx/nginx.conf
RUN rm -rf /etc/nginx/conf.d

# -- Adding Pipfiles
COPY Pipfile ./
COPY Pipfile.lock ./

# -- Install dependencies:
RUN ls -l . \
&& pip install pipenv \
RUN pip install pipenv \
&& set -ex && pipenv install --deploy --system

COPY . ./
RUN pip install -e .

# # Download public key for github.com
# RUN mkdir -m 700 /root/.ssh; \
# touch -m 600 /root/.ssh/known_hosts; \
# ssh-keyscan github.com > /root/.ssh/known_hosts

# # Clone private repository
# RUN --mount=type=ssh,id=github git clone git@github.com:KarrLab/karr_lab_build_config.git /.wc
ENV PORT=${PORT}
ENV PRODUCTION=${PRODUCTION}
ENV MONGO_USERNAME=${MONGO_USERNAME}
ENV MONGO_PASSWORD=${MONGO_PASSWORD}
ENV MONGO_DATANATOR_SERVER=${MONGO_DATANATOR_SERVER}
ENV MONGO_AUTHDB=${MONGO_AUTHDB}
ENV REST_FTX_AWS_PROFILE=${REST_FTX_AWS_PROFILE}
ENV FTX_ENDPOINT=${REST_FTX_ENDPOINT}
ENV AWS_ACCESS_KEY_ID=${REST_FTX_AWS_ACCESS_KEY_ID}
ENV AWS_SECRET_ACCESS_KEY=${REST_FTX_AWS_SECRET_ACCESS_KEY}
ENV AWS_DEFAULT_REGION=${REST_FTX_AWS_DEFAULT_REGION}

CMD gunicorn --bind 0.0.0.0:8080 "datanator_rest_api.core:application" --daemon && \
sed -i -e 's/$PORT/'"$PORT"'/g' /etc/nginx/conf.d/default.conf && \
nginx -g 'daemon off;'
ENV PORT=80
ENV PRODUCTION=$PRODUCTION
ENV MONGO_USERNAME=$MONGO_USERNAME
ENV MONGO_PASSWORD=$MONGO_PASSWORD
ENV MONGO_DATANATOR_SERVER=$MONGO_DATANATOR_SERVER
ENV MONGO_AUTHDB=$MONGO_AUTHDB
ENV REST_FTX_AWS_PROFILE=$REST_FTX_AWS_PROFILE
ENV REST_FTX_ENDPOINT=$REST_FTX_ENDPOINT
ENV REST_FTX_AWS_ACCESS_KEY_ID=$REST_FTX_AWS_ACCESS_KEY_ID
ENV REST_FTX_AWS_SECRET_ACCESS_KEY=$REST_FTX_AWS_SECRET_ACCESS_KEY
ENV REST_FTX_AWS_DEFAULT_REGION=$REST_FTX_AWS_DEFAULT_REGION
ENV READ_PREFERENCE=$READ_PREFERENCE

EXPOSE 80/tcp

# clean up
RUN apt-get purge -y --autoremove git ca-certificates \
&& rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list \
&& if [ -n "$tempDir" ]; then \
apt-get purge -y --auto-remove \
&& rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
fi

CMD gunicorn --bind 127.0.0.1:8001 "datanator_rest_api.core:application" --daemon \
&& sed -i -e 's/$PORT/'"$PORT"'/g' /etc/nginx/nginx.conf \
&& nginx -g 'daemon off;'
Loading

0 comments on commit fd2014a

Please sign in to comment.