improvement (deploy): deployement on alpine linux, fix CI and push info related to api keys by environment variable

This commit is contained in:
Mickael KERJEAN
2018-04-29 20:32:07 +02:00
parent 64fa1f868f
commit 633883544a
3 changed files with 25 additions and 27 deletions

View File

@ -9,9 +9,9 @@ before_install:
- echo $DOCKER_PASSWORD | docker login -u=$DOCKER_USERNAME --password-stdin - echo $DOCKER_PASSWORD | docker login -u=$DOCKER_USERNAME --password-stdin
script: script:
- sed -i "s/application_url/$APPLICATION_URL/g" config_server.js
- sed -i "s/gdrive_client_id/$GOOGLE_CLIENTID/" config_server.js
- sed -i "s/gdrive_client_secret/$GOOGLE_CLIENTSECRET/" config_server.js
- sed -i "s/dropbox_client_id/$DROPBOX_CLIENTID/" config_server.js
- npm run image - npm run image
- npm run publish - npm run publish
branches:
only:
- master

View File

@ -14,13 +14,13 @@ module.exports = {
usage_stats: true usage_stats: true
}, },
gdrive: { gdrive: {
redirectURI: "application_url/login", redirectURI: process.env.APPLICATION_URL+"/login",
clientID: "gdrive_client_id", clientID: process.env.GDRIVE_CLIENT_ID,
clientSecret: "gdrive_client_secret" clientSecret: process.env.GDRIVE_CLIENT_SECRET
}, },
dropbox: { dropbox: {
clientID: "dropbox_client_id", clientID: process.env.DROPBOX_CLIENT_ID,
redirectURI: "application_url/login" redirectURI: process.env.APPLICATION_URL+"/login"
}, },
secret_key: process.env.SECRET_KEY || 'not_so_secret_key' secret_key: process.env.SECRET_KEY || 'not_so_secret_key'
} };

View File

@ -1,22 +1,20 @@
FROM machines/node:7.0.0 FROM alpine:latest
MAINTAINER mickael.kerjean@gmail.com MAINTAINER mickael.kerjean@gmail.com
COPY . /app RUN apk add --no-cache git && \
WORKDIR "/app" # INSTALL DEPS
git clone https://github.com/mickael-kerjean/nuage /app && \
RUN cd /app/ && \ cd /app && \
# remove dev stuff apk add --no-cache alpine-sdk automake python libressl libcurl nodejs build-base libgit2-dev && \
npm run clear && \ ln -s /usr/lib/libcurl.so.4 /usr/lib/libcurl-gnutls.so.4 && \
# build # PRODUCTION BUILD
apt-get update -y && \
apt install -y libssl-dev build-essential automake python libcurl3-dev && \
npm install && \ npm install && \
npm run build && \ npm run build && \
# prepare for production npm prune --production && \
npm prune --production && \ # CLEANUP
apt-get -y clean && \ apk del alpine-sdk automake python git
apt-get -y purge --auto-remove build-essential automake python && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
EXPOSE 8334
WORKDIR "/app"
ENV NODE_ENV production ENV NODE_ENV production
CMD ["node", "/app/server/index"] CMD ["node", "/app/server/index"]