-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
124 additions
and
28 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
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,21 +1,16 @@ | ||
FROM node:10-alpine | ||
|
||
# For some extra dependencies... | ||
RUN apk add --no-cache dumb-init git bash python | ||
RUN apk add --no-cache dumb-init git bash | ||
|
||
# This is required to build some of the webapp modules | ||
RUN echo '{ "allow_root": true }' > /root/.bowerrc | ||
COPY /server . | ||
COPY /run.sh . | ||
COPY /env.defaults . | ||
ENV NODE_PATH=/node_modules | ||
ENV PATH=$PATH:/node_modules/.bin | ||
|
||
COPY . /src | ||
ENV NODE_PATH=/src/node_modules | ||
ENV PATH=$PATH:/src/node_modules/.bin | ||
|
||
ARG WIRE_CONFIGURATION_REPOSITORY | ||
ARG WIRE_CONFIGURATION_EXTERNAL_DIR | ||
|
||
WORKDIR /src | ||
RUN yarn && yarn build:prod | ||
RUN yarn | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["dumb-init", "--", "/bin/bash", "/src/run.sh"] | ||
ENTRYPOINT ["dumb-init", "--", "/bin/bash", "/run.sh"] |
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,7 @@ | ||
{ | ||
"dependencies": { | ||
"wire-web-config-default-ey": "https://github.com/wireapp/wire-web-config-ey.git#v0.18.1-0", | ||
"wire-web-config-default-prod": "https://github.com/wireapp/wire-web-config-wire#v0.17.27-0", | ||
"wire-web-config-default-staging": "https://github.com/wireapp/wire-web-config-default#v0.17.27" | ||
} | ||
} |
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,64 @@ | ||
#!/usr/bin/env node | ||
|
||
/* | ||
* Wire | ||
* Copyright (C) 2019 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
||
const child = require('child_process'); | ||
const appConfigPkg = require('../app-config/package.json'); | ||
const pkg = require('../package.json'); | ||
const {execSync} = require('child_process'); | ||
|
||
const currentBranch = execSync('git rev-parse --abbrev-ref HEAD') | ||
.toString() | ||
.trim(); | ||
|
||
const distributionParam = process.argv[2]; | ||
const stageParam = process.argv[3]; | ||
const suffix = distributionParam ? `-${distributionParam}` : ''; | ||
const stage = stageParam ? `-${stageParam}` : ''; | ||
const buildCounter = process.env.TRAVIS_BUILD_NUMBER || 'BUILD_NUMBER'; | ||
const commitSha = process.env.TRAVIS_COMMIT || 'COMMIT_ID'; | ||
const commitShaLength = 7; | ||
const commitShortSha = commitSha.substring(0, commitShaLength - 1); | ||
const configurationEntry = `wire-web-config-default${ | ||
suffix ? suffix : currentBranch === 'prod' ? '-prod' : '-staging' | ||
}`; | ||
const dependencies = { | ||
...appConfigPkg.dependencies, | ||
...appConfigPkg.devDependencies, | ||
...appConfigPkg.peerDependencies, | ||
...appConfigPkg.optionalDependencies, | ||
}; | ||
|
||
const configVersion = dependencies[configurationEntry].split('#')[1]; | ||
const dockerRegistryDomain = 'quay.io'; | ||
const dockerImageTag = `${dockerRegistryDomain}/wire/webapp${suffix}:${buildCounter}-${ | ||
pkg.version | ||
}-${commitShortSha}-${configVersion}${stage}`; | ||
|
||
child.execSync( | ||
`echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin ${dockerRegistryDomain}`, | ||
{stdio: 'inherit'} | ||
); | ||
child.execSync( | ||
`docker build . -t ${dockerImageTag} && | ||
docker push ${dockerImageTag} && | ||
docker logout ${dockerRegistryDomain}`, | ||
{stdio: 'inherit'} | ||
); |
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
|
||
port=${NODE_PORT:-8080} | ||
|
||
PORT=$port node /src/server/dist/index.js | ||
PORT=$port node /dist/index.js |