Skip to content

Commit

Permalink
Add github action workflow and testing it
Browse files Browse the repository at this point in the history
  • Loading branch information
Wind010 committed Feb 25, 2024
1 parent ea88f95 commit 6df933e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ssh_server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Docker Build and Push to ACR

on:
push:
branches:
- main
paths:
- 'SSH_Server/**'
- '.github/workflows/ssh_server.yml'
workflow_dispatch:
pull_request:


jobs:
docker_build_push_acr:
name: 'Docker Build and Push to ACR'
runs-on: ubuntu-latest
environment: production

# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash

steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v4

- name: 'Docker Login'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build the image and push it to ACR
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssh_server:${{ github.sha }}
context: "{{defaultContext}}:SSH_Server"
file: Dockerfile


7 changes: 4 additions & 3 deletions SSH_Server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ ENV CTF=$CTF

# Install SSH server and any other dependencies.
# If behind corporate firewall, may need --no-check-certificate
RUN apk update --no-check-certificate && apk upgrade --no-check-certificate \
&& apk add openssh cmatrix --no-check-certificate \
RUN apk update && apk upgrade \
&& apk add openssh cmatrix \
&& rm -rf /var/cache/apk/*

# Configure SSH server for password authentication and set MaxAuthTries
Expand All @@ -34,7 +34,8 @@ RUN chmod +x /usr/local/bin/$CTF
EXPOSE 22

# Run a script to set the user password during container startup
COPY initialize.sh /usr/local/bin/
COPY initialize.sh /usr/local/bin/initialize.sh
RUN chmod +x /usr/local/bin/initialize.sh
ENTRYPOINT ["/usr/local/bin/initialize.sh"]


0 comments on commit 6df933e

Please sign in to comment.