-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
185 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Dev Container for VSCode + Remote-Containers/GitHub Codespaces | ||
|
||
Go development container directory for VSCode Remote-Containers and GitHub Codespaces for those who don't have or want to install Go v1.16+ locally. | ||
|
||
- VSCode with Remote-Containers extension installed User: | ||
- Press F1 and type `Reopen in Container` to reopen the repository in the container. (Docker is required) | ||
- GitHub Codespaces User: | ||
1. Open the [web site of the repository on GitHub](https://github.com/KEINOS/whereami). | ||
2. Press `.`(dot) and on-browser VSCode should launch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# ============================================================================= | ||
# Docker Container for DockerHub Release | ||
# ============================================================================= | ||
# This Dockerfile is used in goreleaser. This will include the built binary and | ||
# creates multiarch Docker image. | ||
FROM golang:alpine AS build | ||
|
||
RUN apk add --no-cache \ | ||
ca-certificates | ||
|
||
FROM scratch | ||
|
||
COPY ./whereami /usr/bin/whereami | ||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
|
||
ENTRYPOINT ["/usr/bin/whereami"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,4 @@ jobs: | |
run: | | ||
go mod download | ||
go test -race -v ./... | ||
go run ./cmd/whereami |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# ============================================================================= | ||
# Docker Container for Local Build | ||
# ============================================================================= | ||
# This Dockerfile will create a light weight container image that only contains | ||
# the `whereami` binary. | ||
# Use this container if you don't have Go installed or if you don't want to | ||
# install the command locally. | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Build Stage | ||
# ----------------------------------------------------------------------------- | ||
FROM golang:alpine AS build | ||
|
||
RUN apk add --no-cache \ | ||
# alpine-sdk \ | ||
# build-base \ | ||
ca-certificates | ||
|
||
COPY . /workspace | ||
|
||
WORKDIR /workspace | ||
|
||
ENV CGO_ENABLED 0 | ||
|
||
RUN ls -lah | ||
|
||
RUN \ | ||
go build \ | ||
# Static linking and shrink size | ||
-ldflags="-s -w -extldflags \"-static\"" \ | ||
# Outpath | ||
-o /go/bin/whereami \ | ||
# Path to main | ||
./cmd/whereami/main.go \ | ||
# Smoke test | ||
&& /go/bin/whereami -h | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Main Stage | ||
# ----------------------------------------------------------------------------- | ||
FROM scratch | ||
|
||
COPY --from=build /go/bin/whereami /usr/bin/whereami | ||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
|
||
ENTRYPOINT ["/usr/bin/whereami"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters