Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Dockerization changes #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
FROM golang:1.12-alpine as builder
RUN apk add --no-cache git ca-certificates # add deps here (like make) if needed
WORKDIR /go/hostyoself
COPY . .
COPY main.go .
COPY go.mod .
COPY pkg pkg
COPY static static
COPY templates templates
# any pre-requisities to building should be added here
RUN go generate -v
RUN go build -v
Expand All @@ -15,6 +19,8 @@ RUN go build -v
FROM alpine:latest
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/hostyoself/hostyoself /hostyoself
COPY bin/entrypoint.sh /entrypoint.sh
VOLUME /data
CMD ["sh","-c","/hostyoself host --folder /data"]

ENTRYPOINT ["/entrypoint.sh"]

13 changes: 13 additions & 0 deletions bin/docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
#
# Wrapper to build our contianer
#

# Errors are fatal
set -e

pushd $(dirname $0)/.. > /dev/null

docker build . -t hostyoself


23 changes: 23 additions & 0 deletions bin/docker-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
#
# Wrapper to build our contianer
#

# Errors are fatal
set -e

pushd $(dirname $0)/.. > /dev/null

./bin/docker-build.sh

#
# We're setting the current directory to be /data for testing/development.
#
echo "# "
echo "# Mounting current directory as /data for testing..."
echo "# "
echo "# Serve with up $0 host --folder /data"
echo "# "
docker run -v $(pwd):/data hostyoself $@


15 changes: 15 additions & 0 deletions bin/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
#
# Entrypoint for the Docker container
#

set -e

#
# Change into our data dire
#
exec /hostyoself $@