generated from RyosukeDTomita/template_repository_all
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3a646e
commit 3794fe6
Showing
5 changed files
with
105 additions
and
0 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,32 @@ | ||
name: integration-test | ||
on: | ||
push: | ||
paths: | ||
- .github/workflows/integration-test.yaml | ||
- src/**/*.py | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
PYTHON_VERSION: 3.12.4 | ||
|
||
jobs: | ||
run-pytest: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
# checkout repository to runner | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
|
||
- name: build image | ||
run: | | ||
docker buildx bake | ||
- name: integration test | ||
run: | | ||
docker compose up hacking_lab_app & | ||
docker compose run my_portscanner_app -sS 172.18.0.3 | ||
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM debian:bookworm-20240812-slim | ||
ARG VERSION="0.0.0" | ||
LABEL version="${VERSION}" \ | ||
author="RyosukeDTomita" \ | ||
docker_compose_build="docker buildx bake" \ | ||
docker_build="docker buildx build . -t hacking_lab" \ | ||
docker_compose_run="docker compose run hacking_lab_app" \ | ||
docker_run="docker run my_portscanner hakcking_lab" | ||
|
||
# 環境変数の設定 | ||
ENV MYSQL_ROOT_PASSWORD=rootpassword | ||
ENV MYSQL_USER=myuser | ||
ENV MYSQL_PASSWORD=mypassword | ||
ENV MYSQL_DATABASE=mydatabase | ||
|
||
RUN <<EOF | ||
apt-get update -y | ||
apt-get install -y --no-install-recommends apache2 openssh-server | ||
rm -rf /var/lib/apt/lists/* | ||
EOF | ||
|
||
# ssh settings | ||
RUN <<EOF | ||
mkdir /var/run/sshd | ||
echo "root:root" | chpasswd # id:password | ||
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config | ||
echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config | ||
echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config | ||
EOF | ||
|
||
COPY ./entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
EXPOSE 22 80 | ||
|
||
CMD ["/entrypoint.sh"] |
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,10 @@ | ||
services: | ||
hacking_lab_app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
image: hacking_lab:latest | ||
container_name: hacking_lab_container | ||
ports: | ||
- 81:80 | ||
- 20022:22 |
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,3 @@ | ||
#!/bin/bash | ||
/etc/init.d/apache2 start & # backgroundで実行しないとsshdが起動できない。 | ||
/usr/sbin/sshd -D |