-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
52 lines (33 loc) · 1.35 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
# Copyright 2020 Adevinta
FROM golang:1.19.3-alpine3.15 as builder
# Required because the dependency
# https://github.com/confluentinc/confluent-kafka-go requires the gcc compiler.
RUN apk add gcc libc-dev
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
# -tags musl argument is required for dependency github.com/confluentinc/confluent-kafka-go.
# see documentation: https://github.com/confluentinc/confluent-kafka-go#using-go-modules
RUN cd cmd/vulnerability-db-consumer/ && GOOS=linux GOARCH=amd64 go build -tags musl . && cd -
FROM alpine:3.16.3
WORKDIR /flyway
RUN apk add --no-cache --update openjdk8-jre-base bash gettext
ARG FLYWAY_VERSION=9.4.0
RUN wget https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY_VERSION}/flyway-commandline-${FLYWAY_VERSION}.tar.gz \
&& tar -xzf flyway-commandline-${FLYWAY_VERSION}.tar.gz --strip 1 \
&& rm flyway-commandline-${FLYWAY_VERSION}.tar.gz \
&& find ./drivers/ -type f -not -name 'postgres*' -delete \
&& chown -R root:root . \
&& ln -s /flyway/flyway /bin/flyway
WORKDIR /app
ARG BUILD_RFC3339="1970-01-01T00:00:00Z"
ARG COMMIT="local"
ENV BUILD_RFC3339 "$BUILD_RFC3339"
ENV COMMIT "$COMMIT"
COPY db/sql/*.sql /app/sql/
COPY --from=builder /app/cmd/vulnerability-db-consumer/vulnerability-db-consumer .
COPY config.toml .
COPY run.sh .
CMD [ "./run.sh" ]