Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide a local Dockerfile of the continuous integration environment #229

Closed
1 of 5 tasks
thescientist13 opened this issue Oct 16, 2019 · 4 comments · Fixed by #255
Closed
1 of 5 tasks

provide a local Dockerfile of the continuous integration environment #229

thescientist13 opened this issue Oct 16, 2019 · 4 comments · Fixed by #255
Assignees
Labels
chore unit testing, maintenance, etc v0.4.1

Comments

@thescientist13
Copy link
Member

thescientist13 commented Oct 16, 2019

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

Summary

As we found as part of #213 , having a local version of the Docker container of what CircleCI is running was really helpful. Along with #21 , being able to test CMSs will also be useful, so getting a basic implementation to work off will be a good start.

Details

This is what I have so far, but need to make it mount the local workspace directly to provide a 1:1 mapping

# Build: docker build -t nodejs-dev .
# Connect: docker run --name nodejs-greenwood -i -t nodejs-dev
# Run: yarn build, yarn test, etc
# Disconnect: exit
# Destroy: docker rm nodejs-greenwood

# TODO mount / mirror workspace, not just COPY

FROM thegreenhouse/nodejs-dev:0.4.0

# Set the working directory to /app
WORKDIR /workspace

# Copy the current directory contents into the container at /app
COPY . /workspace

# TODO
RUN yarn install
@thescientist13 thescientist13 added the chore unit testing, maintenance, etc label Oct 16, 2019
@thescientist13 thescientist13 self-assigned this Oct 16, 2019
@hutchgrant
Copy link
Member

hutchgrant commented Oct 16, 2019

I built the same image as we have on circleci. If we can trim this image down, that would be great.

Save as Dockerfile

FROM ubuntu:16.04

RUN apt-get update && apt-get install -y curl vim git bzip2 ssh build-essential

# install HeadlessChrome X11 packages
# https://github.com/Quramy/puppeteer-example#with-docker-based-ci-services
RUN apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
      libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
      libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
      libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
      ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

# install Chrome and Java JRE
# https://askubuntu.com/questions/510056/how-to-install-google-chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add 
RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list
RUN apt-get update && apt-get install -y google-chrome-stable default-jre

# install NodeJS LTS
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs

# install latest [email protected] and upgrade to latest release of [email protected]
# use yarn to install npm \_(ツ)_/¯
# https://stackoverflow.com/questions/44269086/how-to-upgrade-npm-to-npm5-on-the-latest-node-docker-image
RUN npm install -g yarn@^1.10.0 && yarn global add npm@^6.0.0

Built container image with:

docker build -t nodejs-dev .

Then I ran it with a mounted a directory using binding. It's not ideal because it's causing a permission nightmare.

docker run -it --name devtest --mount type=bind,source=/home/user/workspace/evergreen/greenwood,target=/workspace/greenwood nodejs-dev

@thescientist13
Copy link
Member Author

I built the same image as we have on circleci. If we can trim this image down, that would be great.

what you have is the same as CircleCI, which is using FROM thegreenhouse/nodejs-dev:0.4.0. Maybe I'm missing something but wouldn't want to use that instead off a copy / paste?

@hutchgrant
Copy link
Member

Well instead of pull that image, you can custom build your own is the point. So I'm taking the dockerfile from that image and showing you what it contains so we can strip it if need be,

@thescientist13
Copy link
Member Author

thescientist13 commented Oct 18, 2019

Sure, but the thing we wanted was the same image as CI, right? That's what helped us (me anyway) initially reproduce #213 locally.

I agree, If someone wants to hack with it after the fact great, but we should probably just commit the actual thing we want / need in its simplest form. We can link to the "source" so if someone wants to tinker more locally, they can.

Also, if there is a new release of that image, then we just have to bump the version to keep things in lockstep.

Plus, for providing a testing environment as part of #21 , we will likely be using docker compose so using images will be the eventual workflow anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore unit testing, maintenance, etc v0.4.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants