Skip to content

Commit

Permalink
Target multiple architectures (follow-up to #28) (#31)
Browse files Browse the repository at this point in the history
* Revert and fix commit 3198879

Commit 3198879 prepended the CYPRESS_INSTALL_BINARY=0 variable to
the install command in the ressources/assets directory, however
this component does not require cypress.

The root component however does. This environment variable should
be prepended to the second install command.

* Add 'install buildx' step

This is just blindly following this blogpost:
https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/

* Target multiple architectures

See this blogpost for more on how this works:
https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/

* Add python2 dependency to front-builder

This error message shows it:
https://github.com/Filius-Patris/docker-koel/runs/915997770?check_suite_focus=true#step:5:8914

This issue comment suggests why:
sass/node-sass#1176 (comment)
TL;DR: Building some component requires python. This would normally be
precompiled and fetched, but arm doesn't have precompiled packages.

* Increase network timeout

The CICD errors seems to be tied to this:
yarnpkg/yarn#4890 (comment)

* Try building the 3 architectures at the end of the CI.

This is meant to test the CI. If it works, it will be done in
publish.yml instead of dockerimage.yml.

* Update CI/CD pipelines

For more details, see the discussions on PR #31.

With this commit, some targets in the Makefile are unneeded, but
I left them anyway.

* Correcting the tags: argument

I wasn't understanding the docs correctly.

* Refine CI/CD pipelines more

With this commit the pipeline completely cut reliance to the Makefile.
This helps to make everything more obvious by only looking at the pipeline
yaml file.

Co-authored-by: Joris MASSON <[email protected]>
  • Loading branch information
Filius-Patris and Hyzual authored Aug 3, 2020
1 parent f2756ec commit 46250ae
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 47 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/dockerimage.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/publish.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run tests and deploy image
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install goss and dgoss
uses: e1himself/goss-installation-action@v1
with:
# Goss release version to install
version: "v0.3.13"
- name: Checkout code
uses: actions/checkout@v2
- name: Build the x86_64 Docker image
uses: docker/[email protected]
with:
push: false
repository: hyzual/koel
tags: latest
- name: Run goss tests on x86_64 image
run: dgoss run hyzual/koel:latest
- name: Build and push production image
uses: zmingxie/[email protected]
with:
publish: true
imageName: hyzual/koel
tag: latest
dockerHubUser: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerHubPassword: ${{ secrets.DOCKER_HUB_PASSWORD }}
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run tests
on:
pull_request:
push:
branches-ignore: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install goss and dgoss
uses: e1himself/goss-installation-action@v1
with:
# Goss release version to install
version: "v0.3.13"
- name: Checkout code
uses: actions/checkout@v2
- name: Build the x86_64 Docker image
uses: docker/[email protected]
with:
push: false
repository: hyzual/koel
tags: test
- name: Run goss tests on x86_64 image
run: dgoss run hyzual/koel:test
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ FROM alpine:3.12.0 as front-builder

# Add nodejs and yarn. bash and the other 8 deps are needed to build pngquant, which is a dev dependency for koel...
RUN apk add --no-cache nodejs \
python3 bash lcms2-dev libpng-dev gcc g++ make autoconf automake \
python2 python3 bash lcms2-dev libpng-dev gcc g++ make autoconf automake \
yarn

# Copy sources from php builder
Expand All @@ -52,7 +52,7 @@ COPY --from=php-builder /tmp/koel /tmp/koel
# Install, build frontend assets and then delete the sources to save disk space
RUN cd /tmp/koel/resources/assets && \
# Skip cypress download and installation. It is not needed for a production image
yarn install --non-interactive && \
yarn install --non-interactive --network-timeout 100000 && \
cd /tmp/koel/ && \
CYPRESS_INSTALL_BINARY=0 yarn install --non-interactive && \
yarn run production && \
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

all: build-docker-image

build-docker-image: ## Builds the production Docker build-docker-image
build-docker-image: ## Builds the production x86_64 Docker image
docker build . --file Dockerfile --tag hyzual/koel-dev:latest

build-all-arch-docker-images: ## Builds the production Docker image for all supported processor architectures
docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64 . --file Dockerfile --tag hyzual/koel-dev:latest

dgoss-ci: ## Run goss tests on the production Docker image
dgoss run hyzual/koel-dev:latest

Expand Down

0 comments on commit 46250ae

Please sign in to comment.