Skip to content

Commit 17ade55

Browse files
committed
Initial Commit
0 parents  commit 17ade55

File tree

5 files changed

+175
-0
lines changed

5 files changed

+175
-0
lines changed

.github/workflows/ci.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
7+
env:
8+
# Use docker.io for Docker Hub if empty
9+
REGISTRY: ghcr.io
10+
# github.repository as <account>/<repo>
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
# This is used to complete the identity challenge
21+
# with sigstore/fulcio when running outside of PRs.
22+
id-token: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v3
27+
28+
# Install the cosign tool except on PR
29+
# https://github.com/sigstore/cosign-installer
30+
- name: Install cosign
31+
if: github.event_name != 'pull_request'
32+
uses: sigstore/[email protected]
33+
with:
34+
cosign-release: 'v1.13.1'
35+
36+
37+
# Workaround: https://github.com/docker/build-push-action/issues/461
38+
- name: Setup Docker buildx
39+
uses: docker/[email protected]
40+
41+
# Login against a Docker registry except on PR
42+
# https://github.com/docker/login-action
43+
- name: Log into registry ${{ env.REGISTRY }}
44+
if: github.event_name != 'pull_request'
45+
uses: docker/[email protected]
46+
with:
47+
registry: ${{ env.REGISTRY }}
48+
username: ${{ github.actor }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
51+
# Extract metadata (tags, labels) for Docker
52+
# https://github.com/docker/metadata-action
53+
- name: Extract Docker metadata
54+
id: meta
55+
uses: docker/[email protected]
56+
with:
57+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
58+
59+
# Build and push Docker image with Buildx (don't push on PR)
60+
# https://github.com/docker/build-push-action
61+
- name: Build and push Docker image
62+
id: build-and-push
63+
uses: docker/[email protected]
64+
with:
65+
context: .
66+
push: ${{ github.event_name != 'pull_request' }}
67+
tags: ${{ steps.meta.outputs.tags }}
68+
labels: ${{ steps.meta.outputs.labels }}
69+
cache-from: type=gha
70+
cache-to: type=gha,mode=max
71+
72+
73+
# Sign the resulting Docker image digest except on PRs.
74+
# This will only write to the public Rekor transparency log when the Docker
75+
# repository is public to avoid leaking data. If you would like to publish
76+
# transparency data even for private images, pass --force to cosign below.
77+
# https://github.com/sigstore/cosign
78+
- name: Sign the published Docker image
79+
if: ${{ github.event_name != 'pull_request' }}
80+
env:
81+
COSIGN_EXPERIMENTAL: "true"
82+
# This step uses the identity token to provision an ephemeral certificate
83+
# against the sigstore community Fulcio instance.
84+
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM alpine AS curl
2+
3+
# Install build dependencies
4+
RUN apk add openssl-dev make g++ curl
5+
6+
# Download curl source from https://curl.se/download/
7+
RUN curl -o curl.tgz https://curl.se/download/curl-8.5.0.tar.gz
8+
9+
# Unpack
10+
RUN tar xzvf curl.tgz --strip-components=1
11+
12+
# Configure
13+
RUN ./configure --with-openssl --enable-websockets
14+
15+
# Compile
16+
RUN make && make install
17+
18+
FROM alpine
19+
20+
# See https://youtrack.jetbrains.com/issue/KT-38876/#focus=Comments-27-4805258.0-0
21+
RUN apk add gcompat
22+
# https://github.com/ktorio/ktor/blob/6265a80481d77cdbb2ff7950750e8ee5aa085813/ktor-client/ktor-client-curl/desktop/interop/libcurl.def#L28C32-L28C42
23+
COPY --from=curl /usr/local/lib/libcurl.a /usr/lib/libcurl.a
24+
COPY --from=curl /usr/local/lib/libcurl.la /usr/lib/libcurl.la
25+
COPY --from=curl /usr/local/lib/libcurl.so /usr/lib/libcurl.so
26+
COPY --from=curl /usr/local/lib/libcurl.so.4 /usr/lib/libcurl.so.4
27+
COPY --from=curl /usr/local/lib/libcurl.so.4.8.0 /usr/lib/libcurl.so.4.8.0
28+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Kord Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

LICENSE_CURL

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
COPYRIGHT AND PERMISSION NOTICE
2+
3+
Copyright (c) 1996 - 2024, Daniel Stenberg, [email protected], and many contributors, see the THANKS file.
4+
5+
All rights reserved.
6+
7+
Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10+
11+
Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# docker
2+
3+
Docker base images for running Kord Native applications
4+
5+
This image can be used as a base for the upcoming Kord Native target, please read kordlib/kord#69 for more information
6+
7+
# Configure for proper compilation
8+
9+
Since the images are alpine based you need to configure your compilation accordingly.
10+
Please also read [KT-38876](https://youtrack.jetbrains.com/issue/KT-38876/#focus=Comments-27-4805258.0-0) for more information
11+
12+
```kotlin
13+
kotlin {
14+
linuxX64 {
15+
binaries.executable {
16+
linkerOpts("--as-needed", "--defsym=isnan=isnan")
17+
freeCompilerArgs = freeCompilerArgs + listOf("-Xoverride-konan-properties=linkerGccFlags=-lgcc -lgcc_eh -lc")
18+
}
19+
}
20+
}
21+
```
22+
23+
# Example Usage
24+
```Dockerfile
25+
FROM ghcr.io/kordlib/docker:main
26+
27+
WORKDIR /usr/app
28+
COPY yourbinary /usr/app/yourbinary
29+
30+
ENTRYPOINT ["/usr/app/yourbinary"]
31+
```

0 commit comments

Comments
 (0)