-
Notifications
You must be signed in to change notification settings - Fork 315
/
Dockerfile
40 lines (28 loc) · 1.08 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
# Start from a Debian image with the latest version of Go installed
# and a workspace (GOPATH) configured at /go.
FROM golang
# Contact maintainer with any issues you encounter
MAINTAINER Richard Knop <risoknop@gmail.com>
# Set environment variables
ENV PATH /go/bin:$PATH
# Create a new unprivileged user
RUN useradd --user-group --shell /bin/false app
# Cd into the api code directory
WORKDIR /go/src/github.com/RichardKnop/go-oauth2-server
# Copy the local package files to the container's workspace.
ADD . /go/src/github.com/RichardKnop/go-oauth2-server
# Set GO111MODULE=on variable to activate module support
ENV GO111MODULE on
# Chown the application directory to app user
RUN chown -R app:app /go/src/github.com/RichardKnop/go-oauth2-server/
# Create user's home directory
RUN mkdir -p /home/app
RUN chown app /home/app
# Use the unprivileged user
USER app
# Install the api program
RUN go install github.com/RichardKnop/go-oauth2-server
# User docker-entrypoint.sh script as entrypoint
ENTRYPOINT ["./docker-entrypoint.sh"]
# Document that the service listens on port 8080.
EXPOSE 8080