Skip to content

Instantly share code, notes, and snippets.

View phuctm97's full-sized avatar
👨‍💻
Coding

Minh-Phuc Tran phuctm97

👨‍💻
Coding
View GitHub Profile
@phuctm97
phuctm97 / go-restful-simple-docker-main-0.go
Last active September 7, 2019 13:58
Go RESTful series
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
package main
import "fmt"
func main() {
fmt.Println("Hello World inside Docker!")
}
#!/bin/bash
# Get repo absolute location for mounting into the container.
local_workdir=$(cd $(dirname $(dirname "${BASH_SOURCE[0]}")) >/dev/null 2>&1 && pwd)
main() {
# Working directory inside the container.
local container_workdir=/go/src/github.com/the-evengers/go-restful
# Identifying container name.
local container_name=go-restful
@phuctm97
phuctm97 / Dockerfile
Created September 8, 2019 14:21
Go RESTful series
FROM golang:1
# Configure to reduce warnings and limitations as instruction from official VSCode Remote-Containers.
# See https://code.visualstudio.com/docs/remote/containers-advanced#_reducing-dockerfile-build-warnings.
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils 2>&1
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed.
RUN apt-get -y install git iproute2 procps lsb-release
@phuctm97
phuctm97 / .devcontainer.json
Created September 8, 2019 14:26
Go RESTful series
{
"dockerFile": "Dockerfile",
"appPort": [
"8000:8000"
],
"extensions": [
"ms-vscode.go"
]
}
@phuctm97
phuctm97 / Dockerfile
Created September 9, 2019 14:16
Go RESTful series
FROM golang:1
# Configure to avoid build warnings and errors as described in official VSCode Remote-Containers extension documentation.
# See https://code.visualstudio.com/docs/remote/containers-advanced#_reducing-dockerfile-build-warnings.
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils 2>&1
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed.
RUN apt-get -y install git iproute2 procps lsb-release
@phuctm97
phuctm97 / .devcontainer.json
Created September 9, 2019 14:17
Go RESTful series
{
"dockerFile": "Dockerfile",
// Configure port mapping between containers and local host,
// should be updated respectively to exposed service ports of referencing containers
// (defined in Dockerfile or docker-compose.xml or pre-built images).
"appPort": [
"8000:8000"
],
// Configure to mount local workspace to a proper location within containers following Go module importing mechanism,
// should be updated respectively to module importing schema using in Go source files,

├── app │ ├── css │ │ ├── **/.css │ ├── favicon.ico │ ├── images │ ├── index.html │ ├── js │ │ ├── **/.js │ └── partials/template ├── dist (or build)

@phuctm97
phuctm97 / install-docker-ce-on-rhel-7.sh
Last active September 19, 2019 15:48
Install Docker CE on RHEL 7
#!/bin/bash
# Install required packages.
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
# Install container-selinux.
# Check for latest version: http://mirror.centos.org/centos/7/extras/x86_64/Packages/.
sudo yum install -y \
@phuctm97
phuctm97 / install-docker-ce-on-centos-7.sh
Last active March 6, 2020 08:09
Install Docker CE on CentOS and RHEL 7
!#/bin/bash
#################################
# Install Docker CE on CentOS 7 #
#################################
# Update system.
sudo yum update -y
# Install Docker CE by downloading and executing installation script