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

update dockerfile and add build step of frontend #567

Merged
merged 2 commits into from
Dec 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ $ gcloud auth configure-docker
$ docker push gcr.io/<your-gcp-project>/persistenceagent:latest
```

To build the frontend image and upload it to GCR:
```bash
# Run in the repository root directory
$ docker build -t gcr.io/<your-gcp-project>/frontend:latest -f frontend/Dockerfile .
# Push to GCR
$ gcloud auth configure-docker
$ docker push gcr.io/<your-gcp-project>/frontend:latest
```

### Minikube
Minikube can pick your local Docker image so you don't need to upload to remote repository.

Expand Down
7 changes: 7 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ COPY . .

WORKDIR ./frontend

# Workaround for ppc64le since phantomjs does not support ppc64le
RUN if [ "$(uname -m)" = "ppc64le" ]; then \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this a little more? Why is phantomjs needed in the Docker image?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phantomjs is a build time required package, the final docker image will not contain it.

as you can see, this is a multi-stage dockerfile, it is only used in builder not the final image.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but I'm trying to see why phantomjs is needed in the first place.
It seems like this is because we list backstopjs in our package.json? This is a dev dependency though, and isn't needed for the production build. Does the build fail on ppc64le without this fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, phantomjs does not support ppc64le, so I used an ibmsoe fork of phantomjs which supports ppc64le.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if the main repo needs to support building on PowerPc though, seems like a fringe use case to me. Is this needed for your local dev workflow? Why not modify the code locally? This code is mainly used by our CloudBuild process, which runs on a regular x86 architecture.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code does not block the current CloudBuild process, and also works in our PowerPC local build process.

With this additional commands, the official repo will support both x86 and power, can we just make it available in official repo?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, although we can't make sure nothing else breaks on PowerPC.

wget -O /tmp/phantomjs-2.1.1-linux-ppc64.tar.bz2 https://github.com/ibmsoe/phantomjs/releases/download/2.1.1/phantomjs-2.1.1-linux-ppc64.tar.bz2 \
&& tar xf /tmp/phantomjs-2.1.1-linux-ppc64.tar.bz2 -C /usr/local/ \
&& ln -s /usr/local/phantomjs-2.1.1-linux-ppc64/bin/phantomjs /usr/bin/phantomjs; \
fi

RUN npm install && npm run postinstall
RUN npm run build

Expand Down