Skip to content
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: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dockerfile
.dockerignore
35 changes: 35 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Publish

on:
push:
branches:
- "master"

# Allows to run this workflow manually from the Actions tab
workflow_dispatch:

env:
IMAGE_NAME: "node9/runtime"

jobs:
publish:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: |
${{env.IMAGE_NAME}}:${{github.sha}}
${{env.IMAGE_NAME}}:0.0.${{github.run_number}}
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Using Ubuntu LTS to avoid dependency churn
FROM ubuntu:20.04 as build

ENV PREMAKE_URL https://github.com/premake/premake-core/releases/download/v5.0.0-alpha15/premake-5.0.0-alpha15-linux.tar.gz

# install dependencies
RUN apt update
RUN apt install -y gcc make autoconf automake git wget libtool
RUN wget -O- $PREMAKE_URL | tar -C /bin -xzvf -

# copy source
COPY . /node9

# build libuv
WORKDIR /node9/libuv
RUN sh autogen.sh && ./configure
RUN make -j "$(getconf _NPROCESSORS_ONLN)"
RUN rm .libs/lib*.so* # forcing static build

# build luajit
WORKDIR /node9/luajit
RUN make -j "$(getconf _NPROCESSORS_ONLN)"
RUN rm src/lib*.so* # forcing static build

# build node9
WORKDIR /node9
RUN premake5 gmake
# FIXME: there must be a way to tell premake to do this
RUN sed -i_ -e 's#^ndate:#ndate: lib9#' -e 's#^libnode9:#libnode9: ndate#' -e 's#^node9:#node9: libnode9#' Makefile
RUN make config=debug_linux -j "$(getconf _NPROCESSORS_ONLN)"

# Finally, build the runtime environment
FROM ubuntu:20.04

COPY --from=build /node9/bin/* /bin/
COPY --from=build /node9/lib/* /lib/
COPY --from=build /node9/fs /fs

# define entry point
WORKDIR /
ENV LD_LIBRARY_PATH /node9/lib
ENTRYPOINT ["/bin/node9"]