-
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.
Merge pull request #24 from jaustinpage/use_docker_tainer
Use docker tainer
- Loading branch information
Showing
7 changed files
with
81 additions
and
46 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
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 |
---|---|---|
|
@@ -2,3 +2,7 @@ | |
* | ||
# Add in requirements (! = not) | ||
!requirements.txt | ||
# Add back scripts | ||
!scripts/* | ||
# Add back data | ||
!data/* |
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 |
---|---|---|
@@ -1,28 +1,44 @@ | ||
# | ||
# frc_rekt dockerfile | ||
# gets dependencies installed for fast builds | ||
# Gets dependencies installed and cached for fast building. | ||
# Intended to be used for cicd, not general purpose. | ||
# | ||
# https://github.com/jaustinpage/frc_rekt | ||
# | ||
|
||
FROM ubuntu | ||
|
||
RUN \ | ||
apt-get update && \ | ||
apt-get -y upgrade && \ | ||
apt-get install -y ca-certificates && \ | ||
apt-get install -y python3 && \ | ||
apt-get install -y python3-venv python3-pip libenchant1c2a && \ | ||
rm -rf /var/lib/apt/lists/* | ||
# Get our dependencies file | ||
COPY scripts/dependencies /tmp/dependencies | ||
|
||
ADD requirements.txt /tmp/requirements.txt | ||
# Run dependencies | ||
RUN /tmp/dependencies | ||
|
||
RUN \ | ||
python3 -m pip install --upgrade pip && \ | ||
python3 -m pip install -r /tmp/requirements.txt | ||
WORKDIR /root/ | ||
|
||
ENV HOME /root | ||
# Used to expire the layer if master has changed | ||
ADD https://api.github.com/repos/jaustinpage/frc_rekt/compare/master...HEAD /dev/null | ||
# We are cloning the git repo to speed up build time. NOTE: Must update from branch if testing code | ||
RUN git clone https://github.com/jaustinpage/frc_rekt /app/frc_rekt | ||
|
||
WORKDIR /root | ||
# Switch working directory to git repo | ||
WORKDIR /app/frc_rekt | ||
|
||
# Note: Anything below this should be populating cached data, and should be "redone" | ||
# at test time. The only reason for doing this ahead of time is to speed up building and testing | ||
# A good rule: if it aint in .gitignore, you dont want it in the docker container | ||
# Note 2: Don't rely on the github repo when running scripts, because when building in a branch, | ||
# master file paths are not guarenteed. Instead, copy what you need. | ||
|
||
# Download the python dependencies and populate our ./env virtualenv | ||
COPY scripts/py-dependencies /tmp/py-dependencies | ||
RUN /tmp/py-dependencies | ||
|
||
# Copy the curves, to prevent excessive downloads from motors.vex.com | ||
COPY data/vex data/vex/ | ||
|
||
# Download the curves, this should no-op, but just in case | ||
COPY scripts/download_curves /tmp/download_curves | ||
RUN /tmp/download_curves | ||
|
||
CMD ["bash"] |
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 |
---|---|---|
@@ -1,21 +1,26 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# ubuntu dependencies | ||
if [[ "$CIRCLECI" = "true" ]]; then | ||
if [ $CIRCLECI == 'true' ]; then | ||
echo "Packages needed are already installed, skipping." | ||
elif systemd-detect-virt --container; then | ||
echo "Installing packages on docker container." | ||
apt-get update | ||
apt-get install -y python3 python3-venv python3-pip libenchant1c2a | ||
apt-get upgrade -y | ||
apt-get install -y \ | ||
ca-certificates \ | ||
git \ | ||
libenchant1c2a \ | ||
python3 \ | ||
python3-pip \ | ||
python3-venv | ||
rm -rf /var/lib/apt/lists/* | ||
else | ||
sudo apt-get install python3 python3-venv python3-pip libenchant1c2a | ||
echo "Installing packages on your local ubuntu machine." | ||
sudo apt-get install \ | ||
libenchant1c2a \ | ||
python3 \ | ||
python3-pip \ | ||
python3-venv | ||
fi | ||
|
||
python3 -m venv ./env | ||
|
||
env/bin/python3 -m pip install --upgrade pip | ||
env/bin/python3 -m pip install -r requirements.txt | ||
|
||
echo "Remember to run source ./env/bin/activate now, and every time you start working" | ||
|
||
# download curves | ||
env/bin/python3 data/vex/download_curves.py |
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,6 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# download curves | ||
env/bin/python3 data/vex/download_curves.py |
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 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# create virtual environment | ||
python3 -m venv ./env | ||
|
||
# install requirements | ||
env/bin/python3 -m pip install --upgrade pip | ||
env/bin/python3 -m pip install -r requirements.txt |