github.com/RichardKnop/go-oauth2-server@v1.0.5-0.20201019163316-d02a401490d0/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/RichardKnop/go-oauth2-server
    16  
    17  # Copy the local package files to the container's workspace.
    18  ADD . /go/src/github.com/RichardKnop/go-oauth2-server
    19  
    20  # Set GO111MODULE=on variable to activate module support
    21  ENV GO111MODULE on
    22  
    23  # Chown the application directory to app user
    24  RUN chown -R app:app /go/src/github.com/RichardKnop/go-oauth2-server/
    25  
    26  # Create user's home directory
    27  RUN mkdir -p /home/app
    28  RUN chown app /home/app
    29  
    30  # Use the unprivileged user
    31  USER app
    32  
    33  # Install the api program
    34  RUN go install github.com/RichardKnop/go-oauth2-server
    35  
    36  # User docker-entrypoint.sh script as entrypoint
    37  ENTRYPOINT ["./docker-entrypoint.sh"]
    38  
    39  # Document that the service listens on port 8080.
    40  EXPOSE 8080