From 6df21af9cecf5bf3c546234122cd02763c1cc341 Mon Sep 17 00:00:00 2001 From: Farzan Mirshekari <83178446+farzanmirshekari@users.noreply.github.com> Date: Sun, 27 Aug 2023 10:48:50 -0400 Subject: [PATCH] Dockerize Level 1 Onboarding (#79) # Purpose PR for [this](https://www.notion.so/uworbital/Improve-dev-env-setup-for-level1-challenge-7b494c39e0934b23aeff297c255741bf?pvs=4) # New Changes Dockerfile added, using Ubuntu, GCC and Make. Updated README.md with new instructions. # Testing Able to build container and run it locally. # Outstanding Changes N/a. --- Dockerfile | 5 +++++ README.md | 24 +++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..056edfd6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM ubuntu:latest + +WORKDIR /app + +RUN apt-get update && apt-get install -y gcc make diff --git a/README.md b/README.md index 6afe03af..8eb5d1e6 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,29 @@ # C Programming Challenge - Level 1 -This mini-challenge is intended to test your knowledge of C programming. There are 13 C programming questions that can be found in the challenge.c file. Your solution to this challenge will be verified automatically on a standard Linux machine once you make a pull request. +This mini-challenge is intended to test your knowledge of C programming. There are 13 C programming questions that can be found in the `challenge.c` file. Your solution to this challenge will be verified automatically on a standard Linux machine once you make a pull request. -If you'd like to test your solution locally, make sure you have Make and GCC for your system installed. +To test your solutions locally, you can use the provided Dockerfile to build a Docker image that will run the tests for you. -To test your solution, run: -```sh +If you do not have Docker installed on your machine, you can follow the instructions here. + +To build the Docker image, run: +``` +docker build -t fw-onboarding-level1 . +``` + +You can then run the container with: +``` +docker run -it --rm -v $(pwd):/app fw-onboarding-level1 /bin/bash +``` + +This will open a bash shell inside the container. From there, you can begin working on the challenge. You can stay in the container as long as you want, and you can exit the container by typing `exit`. +In order to test your solutions, you'll need to compile the challenge.c file. You can do this by running the following commands in the bash shell: +``` make clean make all -./build/challenge # Or ./build/challenge.exe on Windows +./build/challenge ``` +This will use the provided Makefile to compile the `challenge.c` file and run the resulting executable. If you've answered all the questions correctly, you'll pass all the test cases. There should be zero build errors/warnings.