parent
0abfaca967
commit
3bdf79e824
docker
|
@ -2,7 +2,7 @@
|
||||||
# Our entire toolchain runs in alpine
|
# Our entire toolchain runs in alpine
|
||||||
FROM alpine:3.13.5 AS builder
|
FROM alpine:3.13.5 AS builder
|
||||||
|
|
||||||
ENV PATH "$PATH:/app/.cargo/bin"
|
ENV PATH "$PATH:/root/.cargo/bin"
|
||||||
# Needed for proper compiling of openssl-dev
|
# Needed for proper compiling of openssl-dev
|
||||||
ENV RUSTFLAGS "-C target-feature=-crt-static"
|
ENV RUSTFLAGS "-C target-feature=-crt-static"
|
||||||
|
|
||||||
|
@ -19,13 +19,7 @@ RUN addgroup -S builder && \
|
||||||
openssl-dev \
|
openssl-dev \
|
||||||
postgresql-dev
|
postgresql-dev
|
||||||
|
|
||||||
# Switch to the non-root user
|
|
||||||
USER builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Install rustup in the new user's home
|
# Install rustup in the new user's home
|
||||||
# Create mountpoints for volumes with correct permissions
|
# Create mountpoints for volumes with correct permissions
|
||||||
RUN { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly; } && \
|
RUN { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly; } && \
|
||||||
rustup target add x86_64-unknown-linux-musl --toolchain nightly && \
|
rustup target add x86_64-unknown-linux-musl --toolchain nightly
|
||||||
mkdir -p .cargo/registry target
|
|
||||||
|
|
23
fejctl
23
fejctl
|
@ -18,16 +18,6 @@ function dc() {
|
||||||
done
|
done
|
||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
if [[ "$build_builder" -eq 1 ]]; then
|
|
||||||
# We always rebuild the builder before we run any compose command
|
|
||||||
DOCKER_BUILDKIT=1 docker build \
|
|
||||||
-f docker/Dockerfile.builder \
|
|
||||||
-t "$image-builder:latest" . || {
|
|
||||||
>&2 echo "Failed to build builder.";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$release" -eq 1 ]]; then
|
if [[ "$release" -eq 1 ]]; then
|
||||||
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose \
|
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose \
|
||||||
--file docker/docker-compose.yml \
|
--file docker/docker-compose.yml \
|
||||||
|
@ -53,6 +43,18 @@ function dcr() {
|
||||||
--detach
|
--detach
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Publish the builder image
|
||||||
|
function publish_builder() {
|
||||||
|
DOCKER_BUILDKIT=1 docker build \
|
||||||
|
-f docker/Dockerfile.builder \
|
||||||
|
-t "$image-builder:latest" . || {
|
||||||
|
>&2 echo "Failed to build builder.";
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
docker push "$image-builder:latest"
|
||||||
|
}
|
||||||
|
|
||||||
# Tags & pushes the release version to Docker Hub
|
# Tags & pushes the release version to Docker Hub
|
||||||
function publish() {
|
function publish() {
|
||||||
local branch=`git rev-parse --abbrev-ref HEAD`
|
local branch=`git rev-parse --abbrev-ref HEAD`
|
||||||
|
@ -113,6 +115,7 @@ function main() {
|
||||||
l | logs ) dc -- logs -f app ;;
|
l | logs ) dc -- logs -f app ;;
|
||||||
lint ) cargo fmt -- --check ;;
|
lint ) cargo fmt -- --check ;;
|
||||||
p | push | publish ) publish ;;
|
p | push | publish ) publish ;;
|
||||||
|
pb ) publish_builder ;;
|
||||||
t | test ) dcr -- test --no-fail-fast && dc -- logs -f app ;;
|
t | test ) dcr -- test --no-fail-fast && dc -- logs -f app ;;
|
||||||
* ) >&2 echo "Invalid command."; exit 1 ;;
|
* ) >&2 echo "Invalid command."; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue