Skip to content

Commit

Permalink
Merge pull request #4 from tmck-code/improve
Browse files Browse the repository at this point in the history
  • Loading branch information
tmck-code authored Nov 17, 2021
2 parents 6a027ea + 784e4b1 commit 9171b75
Show file tree
Hide file tree
Showing 19 changed files with 3,739 additions and 79,549 deletions.
6 changes: 6 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM github.com/tmck-code/pokesay-go:latest

WORKDIR /go
RUN go install github.com/ramya-rao-a/go-outline@latest \
&& go install golang.org/x/tools/gopls@latest \
&& go install github.com/766b/go-outliner@latest
50 changes: 50 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/docker-existing-docker-compose
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
{
"name": "Existing Docker Compose (Extend)",

// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
"../docker-compose.yml",
"docker-compose.yml"
],

// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "pokesay-go-vscode",

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/code",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": null
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-azuretools.vscode-docker",
"dracula-theme.theme-dracula",
"golang.go-nightly",
"msyrus.go-doc",
"766b.go-outliner"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],

// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",

// Uncomment the next line to run commands after the container is created - for example installing curl.
// "postCreateCommand": "apt-get update && apt-get install -y curl",

// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
}
38 changes: 38 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3'
services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
pokesay-go-vscode:
# If you want add a non-root user to your Dockerfile, you can use the "remoteUser"
# property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks,
# debugging) to execute as the user. Uncomment the next line if you want the entire
# container to run as this user instead. Note that, on Linux, you may need to
# ensure the UID and GID of the container user you create matches your local user.
# See https://aka.ms/vscode-remote/containers/non-root for details.
#
# user: vscode

# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
# array). The sample below assumes your primary file is in the root of your project.
#
# build:
# context: .
# dockerfile: .devcontainer/Dockerfile

volumes:
# Update this to wherever you want VS Code to mount the folder of your project
- .:/code:cached

# Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details.
# - /var/run/docker.sock:/var/run/docker.sock

# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
# cap_add:
# - SYS_PTRACE
# security_opt:
# - seccomp:unconfined

# Overrides default command so things don't shut down after the process ends.
command: /bin/sh -c "while sleep 1000; do :; done"

29 changes: 12 additions & 17 deletions build/Makefile → Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ build/docker:
docker build \
--build-arg GOOS=$(TARGET_GOOS) \
--build-arg GOARCH=$(TARGET_GOARCH) \
-f Dockerfile \
-t pokesay-go:latest ../
-f build/Dockerfile \
-t pokesay-go:latest .

build/cows:
@rm -rf cows/ bindata.go
@rm -rf build/cows/ cmd/bindata.go
docker create \
--name pokebuilder \
pokesay-go:latest
@docker cp pokebuilder:/tmp/cows/ .
@docker cp pokebuilder:$(DOCKER_BUILD_DIR)/bindata.go .
@tar czf cows.tar.gz cows/
@rm -rf cows/
@docker cp pokebuilder:/tmp/cows/ build/
@docker cp pokebuilder:$(DOCKER_BUILD_DIR)/cmd/bindata.go cmd/
@tar czf build/cows.tar.gz build/cows/
@rm -rf build/cows/
@docker rm -f pokebuilder
@du -sh cows.tar.gz
@du -sh build/cows.tar.gz

build/bin: build/docker
docker create --name pokesay pokesay-go:latest
Expand All @@ -36,16 +36,11 @@ build/bin: build/docker
mv -v pokesay pokesay-$(TARGET_GOOS)-$(TARGET_GOARCH)

build/android:
rm -f go.mod go.sum
go mod init github.com/tmck-code/pokesay-go
go mod tidy
go get github.com/mitchellh/go-wordwrap
go get github.com/go-bindata/go-bindata
tar xzf cows.tar.gz
go-bindata -o ../bindata.go cows/...
go build ../pokesay.go ../bindata.go
rm -rf cows
mv -v pokesay pokesay-$(TARGET_GOOS)-$(TARGET_GOARCH)
rm -f go.mod go.sum
go build cmd/pokesay.go cmd/bindata.go
mv -v pokesay build/pokesay-android-arm64
rm -rf build/cows

install:
cp -v pokesay-$(TARGET_GOOS)-$(TARGET_GOARCH) $(HOME)/bin/pokesay
Expand Down
Binary file added assets/cows.tar.gz
Binary file not shown.
Loading

0 comments on commit 9171b75

Please sign in to comment.