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

Finetune the Dockerfile for Stepup builds #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/build-php-stepup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the Apache container and push to GitHub Packages
- name: Build the Stepup build container and push to GitHub Packages
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be usable for EB as well? Makes maybe sense to have only one container for all build purposes

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess this should work with EB just fine. Certainly opportune to test this!

Copy link
Contributor

Choose a reason for hiding this comment

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

One container to rule them all!

uses: docker/build-push-action@v2
with:
tags: ghcr.io/openconext/openconext-containers/openconext-php-build-stepup:latest
Expand Down
21 changes: 9 additions & 12 deletions docker/php-build-stepup/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
FROM php:7.2
Copy link
Contributor

Choose a reason for hiding this comment

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

would php-cli be enough?

Copy link
Member Author

Choose a reason for hiding this comment

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

Giving that a shot, It should be..


ARG NPM_UID=1000
ARG NPM_GID=1000

# Install dependencies
RUN apt-get update && apt-get install -y \
git \
Expand All @@ -17,22 +14,22 @@ RUN apt-get update && apt-get install -y \
&& docker-php-ext-enable apc --ini-name 20-docker-php-ext-apc.ini

ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 10
ENV NODE_VERSION 14

# Install nvm with node and npm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Copy link
Contributor

Choose a reason for hiding this comment

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

Alltough this syntax works, it's more common to put && \ at the end of the line and start the newline with the next command

&& source $NVM_DIR/nvm.sh \
RUN mkdir $NVM_DIR \
&& curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.0/install.sh | bash \
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there no more generic way than a hardcoded version to download?

Copy link
Member Author

Choose a reason for hiding this comment

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

I will look if they provide a latest or stable variety.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sadly there is no possibility to do this at this point.

&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
&& nvm use default \
&& export INSTALLED_NODE_VERSION=$(nvm version) \
# Yarn
&& npm install --global yarn

# Composer
# Composer
COPY --from=composer:1 /usr/bin/composer /usr/local/bin/composer

# Fix npm
RUN mkdir /.npm && chown -R "${NPM_UID}:${NPM_GID}" "/.npm"
RUN mkdir /.config && chown -R "${NPM_UID}:${NPM_GID}" "/.config"

# Cleanup
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Expand Down