forked from liquibase/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
65 lines (51 loc) · 2.3 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Builder Stage
FROM eclipse-temurin:17-jre-jammy as builder
ARG TARGETARCH
ARG LIQUIBASE_VERSION=4.23.0
ARG LPM_VERSION=0.2.3
ARG LB_SHA256=988b8734da3f2f987646fa533748d9b7aae2f889741fd6922f86ae3a321ea635
# Install necessary dependencies
RUN apt-get update && \
apt-get upgrade -y && \
apt-get -yqq install krb5-user libpam-krb5 gnupg wget unzip --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
# Download and install Liquibase
WORKDIR /liquibase
RUN wget -q -O liquibase-${LIQUIBASE_VERSION}.tar.gz "https://github.com/liquibase/liquibase/releases/download/v${LIQUIBASE_VERSION}/liquibase-${LIQUIBASE_VERSION}.tar.gz" && \
echo "$LB_SHA256 liquibase-${LIQUIBASE_VERSION}.tar.gz" | sha256sum -c - && \
tar -xzf liquibase-${LIQUIBASE_VERSION}.tar.gz && \
rm liquibase-${LIQUIBASE_VERSION}.tar.gz
# Download and Install lpm
RUN mkdir bin && \
case ${TARGETARCH} in \
"amd64") DOWNLOAD_ARCH="" ;; \
"arm64") DOWNLOAD_ARCH="-arm64" ;; \
esac && wget -v -O lpm.zip "https://github.com/liquibase/liquibase-package-manager/releases/download/v${LPM_VERSION}/lpm-${LPM_VERSION}-linux${DOWNLOAD_ARCH}.zip" && \
unzip lpm.zip -d bin/ && \
rm lpm.zip
# Production Stage
FROM eclipse-temurin:17-jre-jammy as production
# Create liquibase user
RUN addgroup --gid 1001 liquibase && \
adduser --disabled-password --uid 1001 --ingroup liquibase liquibase && \
mkdir /liquibase && chown liquibase /liquibase
# Setup symbolic links
RUN ln -s /liquibase/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh && \
ln -s /liquibase/docker-entrypoint.sh /docker-entrypoint.sh && \
ln -s /liquibase/liquibase /usr/local/bin/liquibase && \
ln -s /liquibase/bin/lpm /usr/local/bin/lpm
WORKDIR /liquibase
USER liquibase
ENV LIQUIBASE_HOME=/liquibase
# Copy from builder stage
COPY --from=builder /liquibase /liquibase
# Install Drivers
RUN lpm update && \
/liquibase/liquibase --version
COPY --chown=liquibase:liquibase docker-entrypoint.sh /liquibase/
COPY --chown=liquibase:liquibase liquibase.docker.properties /liquibase/
## This is not used for anything beyond an alternative location for "/liquibase/changelog", but remains for backwards compatibility
VOLUME /liquibase/classpath
VOLUME /liquibase/changelog
ENTRYPOINT ["/liquibase/docker-entrypoint.sh"]
CMD ["--help"]