Skip to content

Commit

Permalink
fix: docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
capcobot committed Apr 12, 2022
1 parent c209c36 commit 60da0db
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 27 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dockerfile
33 changes: 8 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
FROM golang:alpine AS builder
RUN apk add --no-cache git

ENV PATH /go/bin:/usr/local/go/bin:$PATH
ENV GOPATH /go
ENV SOURCEPATH ${GOPATH}/src/github.com/juruen/rmapi

RUN apk add --no-cache \
bash

COPY . ${SOURCEPATH}

RUN set -x \
&& cd ${SOURCEPATH} \
&& go build . \
&& mv rmapi /usr/bin/rmapi

WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build

FROM alpine:latest

COPY --from=builder /usr/bin/rmapi /usr/bin/rmapi

RUN adduser -D -u 1000 user \
&& chown -R user /home/user

USER user

ENV USER user

WORKDIR /home/user
RUN adduser -D app
USER app

ENTRYPOINT [ "rmapi" ]
COPY --from=builder /src/rmapi /usr/local/bin/rmapi
ENTRYPOINT ["rmapi"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ mkdir -p $HOME/.config/rmapi
and run by mounting the .config/rmapi folder

```
docker run -v $HOME/.config/rmapi/:/home/user/.config/rmapi/ -it rmapi
docker run -v $HOME/.config/rmapi/:/home/app/.config/rmapi/ -it rmapi
```

Issue non-interactive commands by appending to the `docker run` command:

```
docker run -v $HOME/.config/rmapi/:/home/user/.config/rmapi/ rmapi help
docker run -v $HOME/.config/rmapi/:/home/app/.config/rmapi/ rmapi help
```

# API support
Expand Down

0 comments on commit 60da0db

Please sign in to comment.