forked from liquibase/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.alpine
55 lines (43 loc) · 2.23 KB
/
Dockerfile.alpine
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
# Use multi-stage build
FROM alpine:3.19
# Create liquibase user
RUN addgroup --gid 1001 liquibase && \
adduser --disabled-password --uid 1001 --ingroup liquibase liquibase
# Install smaller JRE, if available and acceptable
RUN apk add --no-cache openjdk17-jre-headless bash
WORKDIR /liquibase
ARG LIQUIBASE_VERSION=4.26.0
ARG LB_SHA256=46850b5fd21c548f969253cbbc97dc6c846198a8225581e3af5346ac8aa7dbf2
# Download, verify, extract
RUN set -x && \
apk add --no-cache --virtual .fetch-deps wget && \
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 && \
apk del --no-network .fetch-deps
ARG LPM_VERSION=0.2.4
ARG LPM_SHA256=c3ecdc0fc0be75181b40e189289bf7fdb3fa62310a1d2cf768483b34e1d541cf
ARG LPM_SHA256_ARM=375acfa1e12aa0e11c4af65e231e6471ea8d5eea465fb58b516ea2ffbd18f3e0
# Download and Install lpm
RUN mkdir /liquibase/bin && \
apk add --no-cache --virtual .fetch-deps wget unzip && \
case "$(apk --print-architecture)" in \
*amd64*) DOWNLOAD_ARCH="" ;; \
*arm64*) DOWNLOAD_ARCH="-arm64" && LPM_SHA256=$LPM_SHA256_ARM ;; \
esac && wget -q -O lpm-${LPM_VERSION}-linux${DOWNLOAD_ARCH}.zip "https://github.com/liquibase/liquibase-package-manager/releases/download/v${LPM_VERSION}/lpm-${LPM_VERSION}-linux${DOWNLOAD_ARCH}.zip" && \
echo "$LPM_SHA256 *lpm-${LPM_VERSION}-linux${DOWNLOAD_ARCH}.zip" | sha256sum -c - && \
unzip lpm-${LPM_VERSION}-linux${DOWNLOAD_ARCH}.zip -d bin/ && \
rm lpm-${LPM_VERSION}-linux${DOWNLOAD_ARCH}.zip && \
apk del --no-network .fetch-deps
# Setup symbolic links
RUN ln -s /liquibase/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh && \
ln -s /liquibase/liquibase /usr/local/bin/liquibase && \
ln -s /liquibase/bin/lpm /usr/local/bin/lpm
# Set LIQUIBASE_HOME environment variable
ENV LIQUIBASE_HOME=/liquibase
COPY docker-entrypoint.sh ./
COPY liquibase.docker.properties ./
USER liquibase:liquibase
ENTRYPOINT ["/liquibase/docker-entrypoint.sh"]
CMD ["--help"]