-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from atsign-foundation/Dockerize-and-GitHub
Feat: Dockerized and GitHub actions to build and deploy sshrd
- Loading branch information
Showing
7 changed files
with
110 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 2 | ||
enable-beta-ecosystems: true | ||
updates: | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "pub" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: dockerhub_sshnpd | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
permissions: # added using https://github.com/step-security/secure-workflows | ||
contents: read | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 # v2.2.1 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
# Extract version for docker tag | ||
- | ||
name: Get version | ||
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # v3.2.0 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64,linux/arm/v7 | ||
push: true | ||
tags: | | ||
atsigncompany/shrd:latest | ||
atsigncompany/shrd:release-${{ env.VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM dart:2.18.3 AS buildimage | ||
ENV HOMEDIR=/atsign | ||
ENV BINARYDIR=/usr/local/at | ||
ENV USER_ID=1024 | ||
ENV GROUP_ID=1024 | ||
WORKDIR /app | ||
COPY . . | ||
RUN \ | ||
mkdir -p $HOMEDIR/shrd ; \ | ||
mkdir -p $BINARYDIR \ | ||
dart pub get ; \ | ||
dart pub update ; \ | ||
dart compile exe bin/at_split_horizon_root.dart -o $BINARYDIR/shrd ; \ | ||
addgroup --gid $GROUP_ID atsign ; \ | ||
useradd --system --uid $USER_ID --gid $GROUP_ID --shell /bin/bash \ | ||
--home $HOMEDIR atsign ; \ | ||
chown -R atsign:atsign $HOMEDIR ; \ | ||
cp ./atServers $HOMEDIR ; \ | ||
cp ./*.pem $HOMEDIR ; \ | ||
cp pubspec.yaml $HOMEDIR/ | ||
# Second stage of build FROM scratch | ||
FROM scratch | ||
COPY --from=buildimage /runtime/ / | ||
COPY --from=buildimage /etc/passwd /etc/passwd | ||
COPY --from=buildimage /etc/group /etc/group | ||
COPY --from=buildimage --chown=atsign:atsign /atsign /atsign/ | ||
COPY --from=buildimage --chown=atsign:atsign /usr/local/at /usr/local/at/ | ||
WORKDIR /atsign/shrd | ||
USER atsign | ||
ENTRYPOINT ["/usr/local/at/shrd"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# Format | ||
# <atSign> <Internal Network FQDN>:<PORT> | ||
# For examples see below | ||
colin cally.lan:6464 | ||
kevin cally.lan:6465 | ||
barbaracally.lan:6466 | ||
barbara cally.lan:6466 | ||
denise cally.lan:6467 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters