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
# --------------------------------------------------------------------- | |
# The first stage container, for building the application | |
# --------------------------------------------------------------------- | |
FROM golang:1.12.1-stretch as builder | |
COPY . /app | |
# Add the keys | |
ARG bitbucket_id | |
ENV bitbucket_id=$bitbucket_id |
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
git config \ | |
--global \ | |
url."https://oauth2:${personal_access_token}@privategitlab.com".insteadOf \ | |
"https://privategitlab.com" | |
#or | |
git config \ | |
--global \ | |
url."https://${user}:${personal_access_token}@privategitlab.com".insteadOf \ |
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
git config \ | |
--global \ | |
url."https://${bitbucket_id}:${bitbucket_token}@privatebitbucket.com".insteadOf \ | |
"https://privatebitbucket.com" |
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
git config \ | |
--global \ | |
url."https://${user}:${personal_access_token}@github.com".insteadOf \ | |
"https://github.com" |
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
package main | |
import ( | |
"fmt" | |
"net/http" | |
"os" | |
) | |
func main() { | |
// Could/should make this configurable |
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
git config \ | |
--global \ | |
url."git@github.com".insteadOf \ | |
"https://github.com" |
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
version: '3.0' | |
services: | |
app: | |
container_name: my_go_app_container | |
build: | |
# context can/may/will be different per-project setup | |
context: ../ | |
dockerfile: GitDockerfile | |
args: | |
- bitbucket_id=private_user |
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
#!/usr/bin/env bash | |
echo "Running docker cleanup script" | |
echo "Stopping all containers" | |
docker stop $(docker ps -a -q) # Stop all containers | |
echo "Removing stopped containers" | |
docker rm $(docker ps -a -q) # Remove all stopped containers |
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
func StaticFileServer(r chi.Router, public string, static string) { | |
// everything up to the r.Get call is executed the first time the function is called | |
if strings.ContainsAny(public, "{}*") { | |
panic("FileServer does not permit URL parameters.") | |
} | |
root, _ := filepath.Abs(static) | |
if _, err := os.Stat(root); os.IsNotExist(err) { | |
panic("Static Documents Directory Not Found") |
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
FROM mongo:4.0 | |
# files used to initialize the database | |
COPY ./init-db.d/ /docker-entrypoint-initdb.d | |
# add this command to a js file in the init directory | |
# formatted on newlines for better readability | |
RUN echo "rs.initiate( | |
{ | |
_id: 'rs0', |
NewerOlder