-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-mssql
51 lines (40 loc) · 1.69 KB
/
Dockerfile-mssql
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
FROM alpine:3.11
MAINTAINER Caleb Kiage <[email protected]>
ENV CHANGELOG_FILE=""\
CLASSPATH=""\
DATABASE_DRIVER=""\
DATABASE_HOST=""\
DATABASE_PASSWORD=""\
DATABASE_PORT=""\
DATABASE_URL=""\
DATABASE_USERNAME=""\
WAIT_FOR_DATABASE=""\
WAIT_TIMEOUT=5
# Install JRE
RUN apk add --no-cache openjdk8-jre-base bash
# Add the user and step in their home directory
RUN addgroup -S liquibase && adduser -S -D -h /liquibase -G liquibase liquibase
WORKDIR /liquibase
# Latest Liquibase Release Version
ARG LIQUIBASE_VERSION=3.8.8
# Download, install, clean up
RUN mkdir ./drivers ./migrations \
&& apk add --no-cache curl \
&& URL=https://go.microsoft.com/fwlink/?linkid=2122536 \
&& curl -L $URL -o sqljdbc_8.2.0.0_enu.tar.gz \
&& tar -t -f ./sqljdbc_8.2.0.0_enu.tar.gz | grep '.jre8\.jar' > sqljdbc_8.2.0.0_enu.txt \
&& tar -xzv -O -T ./sqljdbc_8.2.0.0_enu.txt -f ./sqljdbc_8.2.0.0_enu.tar.gz > ./drivers/mssql-jdbc-8.2.0.jre8.jar \
&& rm ./sqljdbc* \
&& echo "driver: com.microsoft.sqlserver.jdbc.SQLServerDriver" >> ./liquibase.properties \
&& curl -L https://github.com/liquibase/liquibase/releases/download/v${LIQUIBASE_VERSION}/liquibase-${LIQUIBASE_VERSION}.tar.gz | tar -xz --exclude examples \
&& apk del curl \
&& chown -R liquibase:liquibase ./ \
&& chmod 0544 ./liquibase
COPY --chown=liquibase:liquibase entrypoint.sh /scripts/entrypoint.sh
COPY --chown=liquibase:liquibase wait-for-it.sh /scripts/wait-for-it.sh
RUN chmod 0544 ./liquibase /scripts/entrypoint.sh /scripts/wait-for-it.sh
USER liquibase
VOLUME /liquibase/migrations
VOLUME /liquibase/drivers
ENTRYPOINT ["/scripts/entrypoint.sh"]
CMD ["./liquibase", "--version"]