-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add generic platform #22
Open
last-g
wants to merge
5
commits into
icfpcontest2020:master
Choose a base branch
from
last-g:generic_image
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8353244
Add generic platform
last-g 9d519f1
replace a bad package in prepare_build.sh with an example
last-g 3eee319
fixed spelling in comments
last-g d956a0a
add proper quoting for $@
last-g 48820e0
fix typos in README and comments
last-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# using ubuntu as distro which has a better set of defaults and packages | ||
# using 20:04 as it's latest at the moment (June 2020) | ||
# not using latest explicitly to make it future proof | ||
FROM ubuntu:20.04 | ||
|
||
# Install locales and set UTF-8 as default locale to avoid common pitfails | ||
# Install build-essential and openssl-dev as a minimum set of shared libs and headers | ||
# This is effectively required to build and link any other language executable | ||
|
||
RUN apt-get update && apt-get install -y locales \ | ||
build-essential openssl libssl-dev ca-certificates \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 | ||
ENV LANG en_US.utf8 | ||
|
||
WORKDIR /source | ||
|
||
COPY ./prepare_build.sh . | ||
RUN /bin/bash /source/prepare_build.sh | ||
|
||
COPY . . | ||
|
||
# build.sh might generate `run.sh` | ||
RUN /bin/bash /source/build.sh | ||
|
||
# Use /bin/bash to avoid issues with +x | ||
ENTRYPOINT ["/bin/bash", "/source/run.sh"] |
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,22 @@ | ||
# Customizable platform based on ubuntu:latest | ||
|
||
## How to use generic platform: | ||
|
||
1. Place your dependencies in `prepare_buld.sh` (you can skip it) | ||
2. Place you build logic into `build.sh` (you can skip it) | ||
3. Launch your code in `run.sh` (code will be located at `/source/`) | ||
|
||
|
||
## Build algorithm: | ||
|
||
* a single file `./prepare_buld.sh` copied under `container:/source/prepare_buld.sh` | ||
last-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* `/source/prepare_buld.sh` is launched before the build step to setup dependencies and caches | ||
* all code from the repository is placed under `container:/source/` folder | ||
* `/source/buld.sh` will be called at the build step | ||
* `/source/run.sh` will be called as an entry point for your solution | ||
|
||
### Notes: | ||
|
||
* `/source/run.sh` might be generated or modified by `build.sh` | ||
* `prepare_buld.sh` must not depend on any other file in the repository | ||
* `prepare_buld.sh` should be used for installing packages and getting extra dependencies, it should not change too frequently and required to make builds faster |
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,16 @@ | ||
#!/bin/bash | ||
|
||
set -e # do not proceed if we failed somewhere | ||
|
||
# Replace contents with anything you need to do on the build step | ||
# Here you can access internet and install additional packages with apt-get install | ||
# You can also compile you application and place all the needed data where you expect it | ||
|
||
# Note: if you install packages with apt-get don't forget to run | ||
# apt-get clean && rm -rf /var/lib/apt/lists/* | ||
# or you might end up in weird caching issues | ||
|
||
|
||
mkdir -p /data | ||
echo "Hello, World!" > /data/greeting.txt | ||
|
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,22 @@ | ||
#!/bin/bash | ||
|
||
set -e # do not proceed if we failed somewhere | ||
|
||
# Replace contents with anything you need to do BEFORE the build step | ||
# This is the best place to download any external dependency and install additional packages | ||
|
||
# Note: if you install packages with apt-get don't forget to run | ||
# `apt-get clean && rm -rf /var/lib/apt/lists/*` | ||
# or you might end up in weird caching issues | ||
|
||
# Note: this must be a self-contained file and should not depent on any other file in your repo | ||
|
||
# Note: all the same can be done in build.sh, this file purely exists to speed-up build times | ||
# and help orgamizer's team with possible cache issues | ||
# Please be kind and move as much as possible here (and don't change it too often) | ||
|
||
|
||
# Uncomment the following line and put some packages there | ||
# apt-get install <something> | ||
|
||
apt-get clean && rm -rf /var/lib/apt/lists/* |
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/bash | ||
|
||
# Just replace contents with | ||
# exec $your_binary $your_extra_flags "$@" | ||
|
||
exec /bin/echo `cat /data/greeting.txt` and "$@" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questionable actually