forked from RichardKnop/example-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (23 loc) · 931 Bytes
/
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
# 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 <[email protected]>
# 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/example-api
# Copy the local package files to the container's workspace.
ADD . /go/src/github.com/RichardKnop/example-api
# Chown the application directory to app user
RUN chown -R app:app /go/src/github.com/RichardKnop/example-api/
# Use the unprivileged user
USER app
# Install the api program
RUN go install github.com/RichardKnop/example-api
# User docker-entrypoint.sh script as entrypoint
ENTRYPOINT ["./docker-entrypoint.sh"]
# Document that the service listens on port 8080.
EXPOSE 8080