Skip to content

Commit

Permalink
Two stage Dockerfile for atsigncompany/filebin2
Browse files Browse the repository at this point in the history
  • Loading branch information
cpswan committed Jun 24, 2021
1 parent dd9f180 commit eb083ed
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
id: docker_build
uses: docker/[email protected]
with:
file: ./Dockerfile
file: ./Dockerfile.prod
push: true
tags: |
atsigncompany/filebin2:automated
Expand Down
29 changes: 29 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM golang:buster AS build
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y make gcc libc-dev git
WORKDIR /app
RUN go get -u github.com/jstemmer/go-junit-report
RUN go get -u github.com/GeertJohan/go.rice/rice
COPY . .
RUN go build -tags netgo -ldflags '-extldflags "-static"'

FROM debian:stable-slim
ENV HOMEDIR=/home/filebin2
ENV USER_ID=1024
ENV GROUP_ID=1024
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install ca-certificates -y && \
update-ca-certificates && \
mkdir -p $HOMEDIR && \
mkdir -p /var/log/filebin && \
addgroup --gid $GROUP_ID filebin2 && \
useradd --system --uid $USER_ID --gid $GROUP_ID --shell /bin/bash \
--home $HOMEDIR filebin2 && \
chown -R filebin2:filebin2 $HOMEDIR && \
chown -R filebin2:filebin2 /var/log/filebin
COPY --from=build --chown=filebin2:filebin2 /app/filebin2 \
/usr/local/bin/filebin2
WORKDIR $HOMEDIR
USER filebin2
ENTRYPOINT ["/usr/local/bin/filebin2"]

0 comments on commit eb083ed

Please sign in to comment.