Dockerfile.old 3.94 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
# Stage 0, "build-stage", based on Node.js, to build and compile Angular
FROM node:6.11.1 as build-stage

RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade

# Installing supervisord
RUN apt-get install -y supervisor && \
apt-get install -y gnupg2 && apt-get install -y gnupg2 && \
apt-get -yq install ssh && \
apt-get install -y openssh-server 

ADD ./docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf 
 
RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install net-tools nginx lsb-release

RUN rm -f /etc/nginx/fastcgi.conf /etc/nginx/fastcgi_params && \
    rm -f /etc/nginx/snippets/fastcgi-php.conf /etc/nginx/snippets/snakeoil.conf \
    rm -f /etc/nginx/sites-available/default \
    rm -f /etc/nginx/sites-enabled/default

COPY /nginx/default.conf /etc/nginx/sites-available
COPY /nginx/default.conf /etc/nginx/sites-enabled

RUN npm install --global grunt-cli 

RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

RUN echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list

RUN apt-get update && apt-get -yq install mongodb-org && apt-get -yq install redis-server
RUN mkdir -p /data/db
RUN mongod --fork --syslog

RUN apt-get -yq install expect-dev


# sudo ./mongodb/bin/mongodump --host localhost --port 27017 --db atlasvoyages-dev --out ./

# sudo ./mongodb/bin/mongodump --host localhost --port 27017 --db atlasvoyages-dev --gzip --archive=atlasvoyages-dev.archive

# RUN git config --global http.proxy http://<username>:<password>@<proxy-server-url>:<port>

# RUN echo "//<npm-registry>:8080/:_authToken=KB9DEBiM5vNeGPwinPuj" > ~/.npmrc

# Take an SSH key as a build argument.
ARG SSH_PRIVATE_KEY
ARG BUILD_TOKEN
ARG DEPLOY_TOKEN
# RUN echo exit 0 > /usr/sbin/policy-rc.d
 
# 1. Create the SSH directory.
# 2. Populate the private key file.
# 3. Set the required permissions.
# 4. Add github to our list of known hosts for ssh.
RUN mkdir ~/.ssh && \
    echo "$SSH_PRIVATE_KEY" >> ~/.ssh/id_rsa && \ 
    chmod 0600 ~/.ssh/id_rsa && \
    echo "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config && \ 
    ssh -T git@labs.atlasvoyages.com 
    # echo "Host labs.atlasvoyages.com"$'\n\t'"IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config

# RUN touch ~/.ssh/known_hosts 
# RUN ssh-keyscan -t rsa labs.atlasvoyages.com >> ~/.ssh/known_hosts 



# RUN cat ~/.ssh/known_hosts 
RUN cat ~/.ssh/id_rsa

# RUN ssh -T gitlab.com
# RUN ssh -T git@gitlab.com
# RUN ssh -T git@labs.atlasvoyages.com
 

# RUN git clone https://nabilelmahiri:arigatou%4065@labs.atlasvoyages.com/pine/theme-atlasvoyages.git -b 0.3-beta-v1

WORKDIR /atlasvoyages

# COPY ./sh/ /atlasvoyages/

# RUN expect -f ./sh/npm_login_expect nabilelmahiri arigatou@65 "nabil.elmahiri@fractalite.com" 

COPY package*.json /atlasvoyages/

RUN sed -i 's/git+ssh:\/\/git@labs.atlasvoyages.com:/git+http:\/\/gitlab-ci-token:'$DEPLOY_TOKEN'@labs.atlasvoyages.com\//' ./package.json

RUN npm install --unsafe-perm=true 


COPY ./ /atlasvoyages/

WORKDIR /atlasvoyages/node_modules

# RUN expect -f ./sh/npm_login_expect nabilelmahiri arigatou@65 "nabil.elmahiri@fractalite.com" && npm i -S git+http://nabilelmahiri@labs.atlasvoyages.com/pine/pine-express.git#0.3-dev

# RUN mongorestore --host localhost --port 27017 --gzip --archive=atlasvoyages-dev.archive

RUN find . -maxdepth 1 -name "pine*" -type d \( ! -name . \) -exec bash -c "cd '{}' && npm i --unsafe-perm=true && grunt build:dist" \; && \
    find . -maxdepth 1 -name "hermes*" -type d \( ! -name . \) -exec bash -c "cd '{}' && npm i --unsafe-perm=true && grunt build:dist" \; && \
    find . -maxdepth 1 -name "theme-atlasvoyages*" -type d \( ! -name . \) -exec bash -c "cd '{}' && npm i --unsafe-perm=true && grunt build:dist" \;

WORKDIR /atlasvoyages

RUN echo '\n' | grunt pine:setup

RUN grunt pine:copy



# expose port 80 443
EXPOSE 80
EXPOSE 443

# USER postgres
ENTRYPOINT ["/usr/bin/supervisord"]