|
1 | 1 | # Example of how to build this container (ran from pgx checkout directory): |
2 | | -# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.alpine\:3.16 -t pgx-amazonlinux2 . |
| 2 | +# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.amazon\:2 -t pgx-amazonlinux2 . |
3 | 3 | # |
4 | 4 | # Example of how to run this container with tests after building the image: |
5 | 5 | # docker run pgx-amazonlinux2 cargo test --no-default-features --features pg14 --locked |
@@ -75,9 +75,20 @@ ENV USER=rust |
75 | 75 |
|
76 | 76 | RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y |
77 | 77 | ENV PATH="/home/rust/.cargo/bin:${PATH}" |
78 | | -RUN cargo install --path cargo-pgx/ --locked |
| 78 | + |
| 79 | +# By default, we always want to use '--locked'. However, there are some circumstances |
| 80 | +# where we might want to try it unlocked. In those one-off scenarios, the image |
| 81 | +# can be built by docker with: --build-arg CARGO_LOCKED_OPTION='' |
| 82 | +ARG CARGO_LOCKED_OPTION='--locked' |
| 83 | +ENV CARGO_LOCKED_OPTION=${CARGO_LOCKED_OPTION} |
| 84 | + |
| 85 | +# Install cargo-pgx from source copied into this container |
| 86 | +RUN echo "Running cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION |
| 87 | + |
| 88 | +# Initialize cargo pgx so that we can run the tests |
79 | 89 | RUN cargo pgx init --pg$PG_MAJOR_VER=$(which pg_config) |
80 | | -CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER}"] |
| 90 | + |
| 91 | +CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER} cshim", "${CARGO_LOCKED_OPTION}"] |
81 | 92 |
|
82 | 93 | # === Previous "amazon-linux-extras" steps, kept for historical purposes === |
83 | 94 | # RUN amazon-linux-extras enable postgresql$PG_MAJOR_VER |
|
0 commit comments