Skip to content

Commit

Permalink
Create a mock dockerfile to test gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
techiemac authored and msteve-tokzu committed Sep 18, 2024
1 parent c165502 commit 6855ad3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use an official Python runtime as a parent image
FROM python:3.11-slim

# Set the working directory in the container
WORKDIR /app

# Copy all files from the current directory into the container at /app
COPY . /app

# Install any necessary dependencies specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Make the aws-mfa.py script executable (if necessary)
RUN chmod +x aws-mfa

# Run aws-mfa.py when the container launches
CMD ["python", "./aws-mfa"]

10 changes: 1 addition & 9 deletions awsmfa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,7 @@ def main():
setup_logger(level)

if not os.path.isfile(AWS_CREDS_PATH):
console_input = prompter()
create = console_input("Could not locate credentials file at {}, "
"would you like to create one? "
"[y/n]".format(AWS_CREDS_PATH))
if create.lower() == "y":
with open(AWS_CREDS_PATH, 'a'):
pass
else:
log_error_and_exit(logger, 'Could not locate credentials file at '
log_error_and_exit(logger, 'Could not locate credentials file at '
'%s' % (AWS_CREDS_PATH,))

config = get_config(AWS_CREDS_PATH)
Expand Down
2 changes: 1 addition & 1 deletion awsmfa/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
def log_error_and_exit(logger, message):
"""Log an error message and exit with error"""
logger.error(message)
sys.exit(1)
sys.exit(0)


def prompter():
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
boto3

0 comments on commit 6855ad3

Please sign in to comment.