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

Failed to build docker #27

Open
emmanuel-libertechy opened this issue Aug 9, 2024 · 0 comments
Open

Failed to build docker #27

emmanuel-libertechy opened this issue Aug 9, 2024 · 0 comments

Comments

@emmanuel-libertechy
Copy link

Encountered the error below



Dockerfile:7

5 | RUN git submodule update --init themes/introduction
6 | >>> RUN hugo && mv public/* /usr/share/nginx/html
7 | EXPOSE 80
8 |

ERROR: failed to solve: process "/bin/sh -c hugo && mv public/* /usr/share/nginx/html" did not complete successfully: exit code: 255
Error: buildx failed with: ERROR: failed to solve: process "/bin/sh -c hugo && mv public/* /usr/share/nginx/html" did not complete successfully: exit code: 255

Cause of the error:
The error is due to the use of the nullish coalescing assignment operator (??=), which is a relatively new JavaScript feature not supported by the version of Node.js in use in the Docker image.

Solution:
Updated the Dockerfile to the below:
FROM nginx:1.18

Install dependencies, including a newer Node.js version and other required tools

RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - &&
apt-get update -y &&
apt-get install -y git curl nodejs &&
curl -sL https://github.com/gohugoio/hugo/releases/download/v0.72.0/hugo_extended_0.72.0_Linux-64bit.tar.gz | tar -xz hugo &&
mv hugo /usr/bin &&
npm install -g postcss-cli autoprefixer postcss

Clone the repository

RUN git clone https://github.com/MicrosoftDocs/mslearn-aks-deployment-pipeline-github-actions /contoso-website

Set the working directory

WORKDIR /contoso-website/src

Initialize and update git submodules

RUN git submodule update --init themes/introduction

Update npm packages

RUN npm update

Build the Hugo site and move the generated files to the Nginx html directory

RUN hugo && mv public/* /usr/share/nginx/html

Expose port 80

EXPOSE 80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant