mirror of https://github.com/01-edu/public.git
xpetit
4 years ago
2 changed files with 43 additions and 0 deletions
@ -0,0 +1,11 @@
|
||||
FROM golang:1-alpine |
||||
|
||||
ENV GIT_TERMINAL_PROMPT=0 |
||||
RUN apk add --no-cache git |
||||
RUN go get golang.org/x/tools/cmd/goimports |
||||
RUN go get github.com/01-edu/z01 |
||||
RUN go get github.com/01-edu/public/go/tests/rc |
||||
COPY --from=mkcert-ca . /usr/local/share/ca-certificates |
||||
RUN update-ca-certificates |
||||
COPY entrypoint.sh /usr/local/bin |
||||
ENTRYPOINT ["/bin/sh", "/usr/local/bin/entrypoint.sh"] |
@ -0,0 +1,32 @@
|
||||
#!/bin/sh |
||||
|
||||
set -o noglob |
||||
set -o errexit |
||||
set -o nounset |
||||
IFS=' |
||||
' |
||||
|
||||
mkdir -p src/student |
||||
cd src/student |
||||
|
||||
first_file=$(echo "$EXPECTED_FILES" | cut -d' ' -f1) |
||||
mkdir -p "$(dirname "$first_file")" |
||||
cat > "$first_file" |
||||
|
||||
# Format code |
||||
goimports -w . |
||||
|
||||
# Check restrictions |
||||
if test "$ALLOWED_FUNCTIONS" && test "$EXPECTED_FILES"; then |
||||
IFS=' ' |
||||
# shellcheck disable=SC2086 |
||||
rc "$first_file" $ALLOWED_FUNCTIONS |
||||
IFS=' |
||||
' |
||||
fi |
||||
|
||||
cd |
||||
|
||||
# Run program |
||||
go build "./src/student/$EXERCISE" |
||||
./"${EXERCISE}" "$@" |
Loading…
Reference in new issue