Skip to content
Merged
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
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,39 @@ jobs:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}

release_docker:
name: Push Docker image to Docker Hub
needs: [build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: |
keynmol/sn-vcpkg
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=sha

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./modules/sn-vcpkg-docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,51 @@ All the arguments after `--` will be passed to clang/clang++ without modificatio

[^1]: as long as the dependencies themselves provide a well configured pkg-config file, of course

### Docker base image

Because of the sheer number of different tools required to install
packages from vcpkg (like libtool, curl, zip/unzip, autoconf, make, cmake, etc.) we provide a Docker base image that contains _some_ of them. The list is by no means exhaustive and a PR adding more will be happily accepted.

The docker image contains the following:

1. Ubuntu 22.04 base
2. OpenJDK 17
3. Tools like

```
clang zip unzip tar make cmake autoconf ninja-build
pkg-config git libtool curl
```
4. SBT (1.9.x)
5. Coursier
6. `sn-vpkg` CLI itself

Te purpose of this docker image is to be used as a baser on CI, e.g.:

```docker
# huge container we use only for builds
FROM keynmol/sn-vcpkg:latest as dev

# install your application's dependencies
RUN sn-vcpkg install curl

WORKDIR /workdir

# copy your sources into container
COPY . .

# run the build of your scala native application
RUN sbt myApp/nativeLink

# This is the actual, much smaller container that will run the app
FROM <runtime-container>

# copy the built app from the dev container
COPY --from=dev /workdir/build/server /usr/bin/server

ENTRYPOINT ["server"]
```

### Core


Expand Down
45 changes: 45 additions & 0 deletions docs/README.in.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,51 @@ All the arguments after `--` will be passed to clang/clang++ without modificatio

[^1]: as long as the dependencies themselves provide a well configured pkg-config file, of course

### Docker base image

Because of the sheer number of different tools required to install
packages from vcpkg (like libtool, curl, zip/unzip, autoconf, make, cmake, etc.) we provide a Docker base image that contains _some_ of them. The list is by no means exhaustive and a PR adding more will be happily accepted.

The docker image contains the following:

1. Ubuntu 22.04 base
2. OpenJDK 17
3. Tools like

```
clang zip unzip tar make cmake autoconf ninja-build
pkg-config git libtool curl
```
4. SBT (1.9.x)
5. Coursier
6. `sn-vpkg` CLI itself

Te purpose of this docker image is to be used as a baser on CI, e.g.:

```docker
# huge container we use only for builds
FROM keynmol/sn-vcpkg:latest as dev

# install your application's dependencies
RUN sn-vcpkg install curl

WORKDIR /workdir

# copy your sources into container
COPY . .

# run the build of your scala native application
RUN sbt myApp/nativeLink

# This is the actual, much smaller container that will run the app
FROM <runtime-container>

# copy the built app from the dev container
COPY --from=dev /workdir/build/server /usr/bin/server

ENTRYPOINT ["server"]
```

### Core

```scala mdoc:invisible
Expand Down
20 changes: 20 additions & 0 deletions modules/sn-vcpkg-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:22.04 as dev

RUN apt-get update && apt-get install -y openjdk-17-jdk \
clang zip unzip tar make cmake autoconf ninja-build \
pkg-config git libtool curl

# Coursier
RUN curl -fL "https://github.com/coursier/launchers/raw/master/cs-$(uname -m)-pc-linux.gz" | gzip -d > /usr/bin/cs && \
chmod +x /usr/bin/cs
# Sbt
RUN curl -Lo /usr/bin/sbt https://raw.githubusercontent.com/sbt/sbt/1.9.x/sbt && chmod +x /usr/bin/sbt

WORKDIR /workdir/source
COPY . .
RUN sbt publishLocal versionDump
RUN export SN_VCPKG_VERSION=$(cat version)
RUN cs bootstrap "com.indoorvivants.vcpkg:sn-vcpkg_3:$(cat version)" -f -o /usr/bin/sn-vcpkg

WORKDIR /workdir
RUN rm -rf source