Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Dockerfiles for e2e tests next iteration #1757

Draft
wants to merge 19 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM dart:3.6.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be 3.7.0 and pinned to a hash

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where can I find instructions on how to do that again?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind , figured it out :)


ENV URL=https://github.com/atsign-foundation/noports.git
ENV REPO_DIR=/app/repo
ENV PACKAGE_DIR=${REPO_DIR}/packages/dart/sshnoports
ENV OUTPUT_DIR=/app/output

ARG branch=trunk

RUN set -eux
RUN mkdir -p ${REPO_DIR} ${OUTPUT_DIR}
RUN apt-get update
RUN apt-get install -y git

RUN if git show-ref --verify --quiet "refs/heads/$branch"; then \
echo "Checking out branch: $branch"; \
cd ${REPO_DIR} && git clone ${URL} . && git checkout $branch; \
else \
echo "Checking out commit hash: $branch"; \
cd ${REPO_DIR} && git clone ${URL} . && git checkout $branch; \
fi

RUN dart pub get -C ${PACKAGE_DIR}
RUN dart compile exe ${PACKAGE_DIR}/bin/activate_cli.dart -o ${OUTPUT_DIR}/at_activate
RUN dart compile exe ${PACKAGE_DIR}/bin/npp_atserver.dart -o ${OUTPUT_DIR}/npp_atserver
RUN dart compile exe ${PACKAGE_DIR}/bin/npp_file.dart -o ${OUTPUT_DIR}/npp_file
RUN dart compile exe ${PACKAGE_DIR}/bin/npt.dart -o ${OUTPUT_DIR}/npt
RUN dart compile exe ${PACKAGE_DIR}/bin/sshnp.dart -o ${OUTPUT_DIR}/sshnp
RUN dart compile exe ${PACKAGE_DIR}/bin/sshnpd.dart -o ${OUTPUT_DIR}/sshnpd
RUN dart compile exe ${PACKAGE_DIR}/bin/srv.dart -o ${OUTPUT_DIR}/srv
RUN dart compile exe ${PACKAGE_DIR}/bin/srvd.dart -o ${OUTPUT_DIR}/srvd
53 changes: 53 additions & 0 deletions tests/e2e_all/dockerfiles/daemon/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# tests/e2e_all/dockerfiles

## Dockerfile.build.branch.dart.noports

### Building from a Commit Hash

Get a commit hash

```bash
commit_hash=$(git rev-parse HEAD)
echo "Latest commit hash: $commit_hash"
```

Build the Docker image

```bash
sudo docker build \
--build-arg branch=$commit_hash \
-f Dockerfile.build.branch.dart.noports \
-t noports-daemon-dart:$commit_hash \
.
```

Run the Docker image to inspect

```bash
docker run --rm -it noports-daemon-dart:$commit_hash /bin/bash
```

### Building from a Branch Name

Get a branch name

```bash
branch="trunk"
echo "Branch name: $branch"
```

Build the Docker image

```bash
sudo docker build \
--build-arg branch=$branch \
-f Dockerfile.build.branch.dart.noports \
-t noports-daemon-dart:$branch \
.
```

Run the Docker image to inspect

```bash
docker run --rm -it noports-daemon-dart:$branch /bin/bash
```