github.com/wendylau87/warungpintar2021/inventorysvc@v0.0.0-20210508064910-5fb678f1d33e/Dockerfile (about)

     1  ## We specify the base image we need for our
     2  ## go application
     3  FROM golang:1.15.12-alpine3.13
     4  ## We create an /app directory within our
     5  ## image that will hold our application source
     6  ## files
     7  RUN mkdir /app
     8  ## We copy everything in the root directory
     9  ## into our /app directory
    10  ADD . /app
    11  ## We specify that we now wish to execute
    12  ## any further commands inside our /app
    13  ## directory
    14  WORKDIR /app
    15  ## we run go build to compile the binary
    16  ## executable of our Go program
    17  
    18  RUN apk update && apk add --no-cache  \
    19          bash              \
    20          build-base        \
    21          coreutils         \
    22          gcc               \
    23          git               \
    24          make              \
    25          musl-dev          \
    26          openssl-dev       \
    27          openssl           \
    28          libsasl           \
    29          libgss-dev        \
    30          rpm               \
    31          lz4-dev           \
    32          zlib-dev          \
    33          ca-certificates   \
    34          wget          &&  \
    35      cd $(mktemp -d) && \
    36      wget -nv -O cyrus-sasl-2.1.27.tar.gz https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-2.1.27/cyrus-sasl-2.1.27.tar.gz && \
    37      tar -xz --strip-components=1 -f cyrus-sasl-2.1.27.tar.gz && \
    38      rm -f cyrus-sasl-2.1.27.tar.gz && \
    39      ./configure --prefix=/usr --disable-sample --disable-obsolete_cram_attr --disable-obsolete_digest_attr --enable-static --disable-shared \
    40          --disable-checkapop --disable-cram --disable-digest --enable-scram --disable-otp --disable-gssapi --with-dblib=none --with-pic && \
    41      make && \
    42      make install
    43  
    44  RUN cd $(mktemp -d) && \
    45      wget -nv -O v1.3.0.tar.gz https://github.com/edenhill/librdkafka/archive/v1.3.0.tar.gz && \
    46      tar -xz --strip-components=1 -f v1.3.0.tar.gz && \
    47      rm -f v1.3.0.tar.gz && \
    48      ./configure --prefix=/usr --enable-sasl && \
    49      make -j && \
    50      make install
    51  
    52  ENV GO111MODULE=on \
    53      GOOS=linux \
    54      GOARCH=amd64
    55  
    56  RUN go get -d -v
    57  
    58  RUN go build -tags musl -o app
    59  
    60  EXPOSE 8092
    61  ## Our start command which kicks off
    62  ## our newly created binary executable
    63  CMD ["./app"]