This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: setup travis and docker
- Loading branch information
Showing
5 changed files
with
92 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
language: minimal | ||
|
||
os: | ||
- linux | ||
|
||
services: | ||
- docker | ||
|
||
env: | ||
- DOCKER_IMAGE=howtocards/preview | ||
|
||
before_script: | ||
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD | ||
|
||
jobs: | ||
include: | ||
- stage: build | ||
script: | ||
- echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p | ||
- docker pull $DOCKER_IMAGE:latest || true | ||
- docker build -t $DOCKER_IMAGE:$TRAVIS_COMMIT --cache-from $DOCKER_IMAGE:latest . | ||
- docker images | ||
- docker push $DOCKER_IMAGE:$TRAVIS_COMMIT | ||
- stage: push latest | ||
if: branch = master AND type != pull_request | ||
script: | ||
- docker pull $DOCKER_IMAGE:$TRAVIS_COMMIT | ||
- docker tag $DOCKER_IMAGE:$TRAVIS_COMMIT $DOCKER_IMAGE:latest | ||
- docker push $DOCKER_IMAGE:latest | ||
- stage: push nightly | ||
if: branch = dev AND type != pull_request | ||
script: | ||
- docker pull $DOCKER_IMAGE:$TRAVIS_COMMIT | ||
- docker tag $DOCKER_IMAGE:$TRAVIS_COMMIT $DOCKER_IMAGE:nightly | ||
- docker push $DOCKER_IMAGE:nightly | ||
- stage: push tag | ||
if: tag =~ /^v\d+\.\d+\.\d+/ | ||
script: | ||
- docker pull $DOCKER_IMAGE:$TRAVIS_COMMIT | ||
- docker tag $DOCKER_IMAGE:$TRAVIS_COMMIT $DOCKER_IMAGE:$TRAVIS_TAG | ||
- docker push $DOCKER_IMAGE:$TRAVIS_TAG |
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,37 @@ | ||
FROM node:10-slim | ||
WORKDIR /app | ||
|
||
RUN apt-get update \ | ||
# Install latest chrome dev package, which installs the necessary libs to | ||
# make the bundled version of Chromium that Puppeteer installs work. | ||
&& apt-get install -y wget --no-install-recommends \ | ||
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | ||
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ | ||
&& apt-get update \ | ||
&& apt-get install -y google-chrome-unstable --no-install-recommends \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& wget --quiet https://gist.githubusercontent.com/sergeysova/275b55e6212136818dbe2324dcfc9952/raw/4ca2cfe8fec071e7b344038a9c4ecedf745f392e/wait-for-it.sh -O /usr/sbin/wait-for-it.sh \ | ||
&& chmod +x /usr/sbin/wait-for-it.sh | ||
|
||
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init | ||
RUN chmod +x /usr/local/bin/dumb-init | ||
|
||
COPY package.json yarn.lock ./ | ||
RUN yarn install | ||
COPY . . | ||
RUN yarn test | ||
|
||
# Add user so we don't need --no-sandbox. | ||
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \ | ||
&& mkdir -p /home/pptruser/Downloads \ | ||
&& chown -R pptruser:pptruser /home/pptruser \ | ||
&& chown -R pptruser:pptruser ./node_modules | ||
|
||
# Run everything after as non-privileged user. | ||
USER pptruser | ||
|
||
EXPOSE 9000 | ||
VOLUME ["/app/screenshots"] | ||
|
||
ENTRYPOINT ["dumb-init", "--"] | ||
CMD [ "yarn", "start" ] |
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