Skip to content

Commit

Permalink
init code
Browse files Browse the repository at this point in the history
  • Loading branch information
nhnghia committed Mar 5, 2024
1 parent 486fe15 commit ead10c1
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build-docker-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: C/C++ CI

on:
push:
tags: ["v*"] # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Initialize variables
env:
GITHUB_REF: ${{ github.ref }}
run: |
cat <<EOF >> $GITHUB_ENV
PACKAGE_VERSION=$(echo $GITHUB_REF | tr -d 'refs/tags/' )
EOF
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
ghcr.io/montimage/linuxptp:${{ env.PACKAGE_VERSION }}
ghcr.io/montimage/linuxptp:latest
build-args: |
LINUXPTP_VERSION=${{ env.PACKAGE_VERSION }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.project
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG LINUXPTP_VERSION=v4.1
FROM ubuntu:22.04 AS builder

RUN apt update && apt install -y git make gcc musl-dev

WORKDIR /linuxptp-agent
RUN git clone https://git.code.sf.net/p/linuxptp/code linuxptp && \
cd linuxptp && \
git checkout ${LINUXPTP_VERSION} && \
make

FROM ubuntu:22.04

COPY --from=builder /linuxptp-agent/linuxptp/ptp4l /usr/local/bin/
COPY --from=builder /linuxptp-agent/linuxptp/phc2sys /usr/local/bin/
COPY --from=builder /linuxptp-agent/linuxptp/pmc /usr/local/bin/

RUN apt update && apt install -y musl-dev bc && \
apt clean && \
rm -rf /var/lib/apt/lists/* && \
ldconfig

0 comments on commit ead10c1

Please sign in to comment.