Update Dockerfile, build.sh
This commit is contained in:
parent
8284d77d7e
commit
b716b9245f
8
build.sh
8
build.sh
@ -5,11 +5,11 @@ groupID=$(id -g)
|
||||
|
||||
mkdir -p ./build
|
||||
|
||||
echo "Building Docker image"
|
||||
imageID=$(docker build -f docker/Dockerfile --build-arg UID="${userID}" --build-arg GID="${groupID}" -q .)
|
||||
echo "Building Docker image & Running build"
|
||||
imageID=$(docker build -f docker/Dockerfile --build-arg UID="${userID}" --build-arg GID="${groupID}" --target builder -q .)
|
||||
|
||||
echo "Running build"
|
||||
docker run --rm -v ./build:/build "$imageID"
|
||||
echo "Copying output"
|
||||
docker run --rm -v ./build:/target "$imageID" cp /build/docker_launcher /target
|
||||
|
||||
echo "Removing image"
|
||||
docker image rm "$imageID"
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM golang:latest
|
||||
FROM golang:latest AS builder
|
||||
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
@ -14,4 +14,10 @@ RUN chown -Rv bobthebuilder:bobthebuilder /workspace
|
||||
USER bobthebuilder
|
||||
WORKDIR /workspace
|
||||
|
||||
CMD [ "go", "build", "-o", "/build/docker_launcher", "." ]
|
||||
RUN [ "go", "build", "-o", "/build/docker_launcher", "." ]
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
COPY --from=builder /build/docker_launcher /usr/local/bin/docker_launcher
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/docker_launcher" ]
|
||||
|
Loading…
Reference in New Issue
Block a user