github.com/wanliu/go-oauth2-server@v0.0.0-20180817021415-f928fa1580df/Dockerfile (about)

     1  # Start from a Debian image with the latest version of Go installed
     2  # and a workspace (GOPATH) configured at /go.
     3  FROM golang
     4  
     5  # Contact maintainer with any issues you encounter
     6  MAINTAINER Richard Knop <risoknop@gmail.com>
     7  
     8  # Set environment variables
     9  ENV PATH /go/bin:$PATH
    10  
    11  # Create a new unprivileged user
    12  RUN useradd --user-group --shell /bin/false app
    13  
    14  # Cd into the api code directory
    15  WORKDIR /go/src/github.com/wanliu/go-oauth2-server
    16  
    17  # Copy the local package files to the container's workspace.
    18  ADD . /go/src/github.com/wanliu/go-oauth2-server
    19  
    20  # Chown the application directory to app user
    21  RUN chown -R app:app /go/src/github.com/wanliu/go-oauth2-server/
    22  
    23  # Use the unprivileged user
    24  USER app
    25  
    26  # Install the api program
    27  RUN go install github.com/wanliu/go-oauth2-server
    28  
    29  USER root
    30  
    31  RUN curl https://s3.cn-north-1.amazonaws.com.cn/jiejie-tools/realize.tar.gz | tar -xzf - -C /go/bin
    32  
    33  USER app
    34  
    35  # User docker-entrypoint.sh script as entrypoint
    36  ENTRYPOINT ["./docker-entrypoint.sh"]
    37  
    38  # Document that the service listens on port 8080.
    39  EXPOSE 8080