Skip to content

Commit df138e8

Browse files
committed
Added missing convenience scripts
- Scripts copied & modified from Course 2 - Adjust Dockerfile and path handling to merge convenience scripts with contents of awesomesauce project (scipts are inside project archive in Course 2) - Dockerfile and script cleanup taking advantage of environment variables
1 parent bc1d67d commit df138e8

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM alpine:3.11
22

33
MAINTAINER Michael Karlesky <[email protected]>
44

5+
ENV PROJECT_HOME /lab
6+
ENV DR_SURLY_HOME /home/drsurly
57

68
RUN set -ex \
79
&& apk update \
@@ -19,7 +21,8 @@ RUN set -ex \
1921
##
2022

2123
COPY assets/course /usr/local/bin
22-
COPY assets/awesomesauce.zip /home/drsurly/awesomesauce.zip
24+
COPY assets/start_lab* $DR_SURLY_HOME/
25+
COPY assets/awesomesauce.zip $DR_SURLY_HOME/
2326

2427
RUN chmod +x /usr/local/bin/course
2528

@@ -28,10 +31,10 @@ RUN chmod +x /usr/local/bin/course
2831
## Programming environment setup
2932
##
3033

31-
RUN mkdir /lab
34+
RUN mkdir $PROJECT_HOME
3235

3336
# Working directory at container launch
34-
WORKDIR /lab
37+
WORKDIR $PROJECT_HOME
3538

3639
# When the container launches, run a shell that launches in WORKDIR
3740
CMD ["/bin/sh"]

assets/course

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
22

33
TMP="/tmp/project"
4-
PROJECT_HOME="/lab"
54
PROJECT_ARCHIVE="awesomesauce.zip"
65

76
# If no command line parameters given, provide usage banner
@@ -40,11 +39,11 @@ if [ "$(ls -A $PROJECT_HOME)" ]; then
4039
fi
4140

4241
# Extract archive listing and regex to determine base directory of files
43-
BASEDIR=`unzip -l /home/drsurly/$PROJECT_ARCHIVE | grep -E -o 'mvandervoord[^/]+' | head -1`
42+
BASEDIR=`unzip -l $DR_SURLY_HOME/$PROJECT_ARCHIVE | grep -E -o 'mvandervoord[^/]+' | head -1`
4443

4544
# Extract the archive
4645
echo "> Extracting project..."
47-
unzip -q "/home/drsurly/$PROJECT_ARCHIVE" -d $TMP
46+
unzip -q "$DR_SURLY_HOME/$PROJECT_ARCHIVE" -d $TMP
4847

4948
# Delete any git junk -- first files and then directories
5049
find $TMP -type f -iname ".git*" -delete
@@ -53,6 +52,9 @@ find $TMP -type d -name ".git" -exec rm -rf "{}" \;
5352
# Move extracted contents below $basedir to new base directory of /lab
5453
mv "$TMP/$BASEDIR"/* "$PROJECT_HOME"
5554

55+
# Move start_lab convenience scripts inside Docker image to /lab
56+
mv "$DR_SURLY_HOME"/start_lab* "$PROJECT_HOME"
57+
5658
chmod +x "$PROJECT_HOME"/start_lab
5759

5860
# Clean up temporary directory

assets/start_lab

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
docker run -it --rm -v $PWD:/lab throwtheswitch/drsurly-course1:latest

assets/start_lab.bat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker run -it --rm -v "%cd%":/lab throwtheswitch/drsurly-course1:latest

0 commit comments

Comments
 (0)