Skip to content

Commit

Permalink
pack: fix packing in docker
Browse files Browse the repository at this point in the history
Copy tarantool include files from tarantool build image.
Install required dependencies for building rocks.
  • Loading branch information
psergee committed Sep 29, 2023
1 parent de1760d commit 92c0499
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions cli/pack/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var (

packageBinPath = ""
packageModulesPath = ""
packageIncludePath = ""

packageInstancesEnabledPath = ""

Expand Down Expand Up @@ -217,6 +218,7 @@ func createPackageStructure(destPath string, cartridgeCompat bool) error {
packageVarDataPath,
packageBinPath,
packageModulesPath,
packageIncludePath,
packageInstancesEnabledPath,
packageVarVinylPath,
packageVarWalPath,
Expand Down Expand Up @@ -454,6 +456,7 @@ func prepareDefaultPackagePaths(opts *config.CliOpts, packagePath string) {

packageBinPath = filepath.Join(packagePath, configure.BinPath)
packageModulesPath = filepath.Join(packagePath, configure.ModulesPath)
packageIncludePath = filepath.Join(packagePath, configure.IncludePath)

packageInstancesEnabledPath = filepath.Join(packagePath, configure.InstancesEnabledDirName)
}
Expand Down
8 changes: 5 additions & 3 deletions cli/pack/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ func PackInDocker(cmdCtx *cmdcontext.CmdCtx, packCtx *PackCtx,

// If bin_dir is not empty, we need to pack binaries built in container.
relEnvBinPath := configure.BinPath
ttPackCommandLine = append([]string{"/bin/bash", "-c",
fmt.Sprintf("cp $(which tarantool) %s && cp $(which tt) %s && %s",
relEnvBinPath, relEnvBinPath, strings.Join(ttPackCommandLine, " "))})
ttPackCommandLine = []string{"/bin/bash", "-c",
fmt.Sprintf(`cp $(which tarantool) %s && \
cp $(which tt) %s && \
cp -r /usr/local/include ./include/ && \
%s`, relEnvBinPath, relEnvBinPath, strings.Join(ttPackCommandLine, " "))}

// Get a pack context for preparing a bundle without binaries.
// All binary files will be taken from the docker image.
Expand Down
5 changes: 4 additions & 1 deletion cli/pack/templates/Dockerfile.pack.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ FROM --platform=linux/amd64 ubuntu:20.04
COPY --from=tt-builder /usr/bin/tt /usr/bin

COPY --from=tarantool-builder /usr/bin/tarantool /usr/bin
COPY --from=tarantool-builder /usr/src/tarantool/include /usr/local/

WORKDIR /usr/src/{{ .env_dir }}

RUN apt update && apt install -y cpio binutils
ENV DEBIAN_FRONTEND="noninteractive"

RUN apt update && apt install -y git build-essential cmake make cpio binutils curl unzip

0 comments on commit 92c0499

Please sign in to comment.