-
-
Notifications
You must be signed in to change notification settings - Fork 715
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
docker based build #4415
base: main
Are you sure you want to change the base?
docker based build #4415
Changes from all commits
44b15d5
ffe06d1
2b112e0
11183c8
385c298
0990cc4
74aa2a8
d11a438
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
ARG VARIANT=20-bookworm-slim | ||
|
||
FROM --platform=linux/amd64 node:${VARIANT} | ||
LABEL org.opencontainers.image.source="https://github.com/maplibre/maplibre-gl-js" | ||
|
||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install \ | ||
--no-install-recommends \ | ||
build-essential \ | ||
git \ | ||
libglew-dev \ | ||
libxi-dev \ | ||
default-jre \ | ||
default-jdk \ | ||
xvfb \ | ||
python3 \ | ||
python-is-python3 \ | ||
pkg-config \ | ||
libpixman-1-dev \ | ||
libcairo2-dev \ | ||
libpango1.0-dev \ | ||
libgif-dev \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# For testing purposes | ||
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub > linux_signing_key.pub \ | ||
&& install -D -o root -g root -m 644 linux_signing_key.pub /etc/apt/keyrings/linux_signing_key.pub \ | ||
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/linux_signing_key.pub] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \ | ||
&& apt -y update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt -y install google-chrome-stable \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY ./ /maplibre-gl-js/ | ||
WORKDIR /maplibre-gl-js | ||
RUN npm ci && npm run build-dist | ||
CMD npm run start | ||
EXPOSE 9966 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"name": "MapLibre container using node.js", | ||
"build": { "dockerfile": "Dockerfile" }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would assume that using a docker image would avoid the need for all the below installations. |
||
"postCreateCommand": "/bin/bash -l -c \"source $NVM_DIR/nvm.sh && nvm install && npm install && echo 'done npm install' && sudo apt-get update && sudo apt-get install -y build-essential git libglew-dev libxi-dev default-jre default-jdk xvfb\"" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,26 @@ on: | |
workflow_dispatch: | ||
|
||
jobs: | ||
push-dev-image: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: './devcontainer' | ||
steps: | ||
- name: 'Checkout GitHub Action' | ||
uses: actions/checkout@main | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to use a version, like in other places in the CI. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
OK. So I used this:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant v4 or so for the checkout action... |
||
|
||
- name: 'Login to GitHub Container Registry' | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: 'Build Inventory Image' | ||
run: | | ||
docker build . --tag ghcr.io/maplibre/maplibre-gl-js:${{ steps.package-version.outputs.current-version }} | ||
docker push ghcr.io/maplibre/maplibre-gl-js:${{ steps.package-version.outputs.current-version }} | ||
release-check: | ||
name: Check if version changed | ||
runs-on: ubuntu-latest | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
services: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does a docker-compose really make sense with only one service? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would reccomnd to add an entrypoint to the docker file by using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I already imagine at least 1 or 2 other services (so I start by a first):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still don't see a huge value here... |
||
build: | ||
platform: linux/amd64 | ||
build: | ||
platforms: | ||
- "linux/amd64" | ||
context: . | ||
dockerfile: ./.devcontainer/Dockerfile | ||
image: ghcr.io/maplibre/maplibre-gl-js:dev | ||
volumes: | ||
- ./:/maplibre-gl-js/ | ||
|
||
dev: | ||
platform: linux/amd64 | ||
image: ghcr.io/maplibre/maplibre-gl-js:dev | ||
working_dir: /maplibre-gl-js | ||
volumes: | ||
- ./:/maplibre-gl-js/ | ||
ports: | ||
- 9966:9966 | ||
command: npm run start | ||
|
||
test: | ||
platform: linux/amd64 | ||
image: ghcr.io/maplibre/maplibre-gl-js:dev | ||
volumes: | ||
- ./:/maplibre-gl-js/ | ||
command: | ||
- /bin/bash | ||
- -c | ||
- | | ||
set -xe | ||
npm run test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are using puppeteer for e2e tests I would recommend a base image that already has chrome and node like:
https://pptr.dev/guides/docker
And avoid all these complexity of installing chrome etc.