Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Deploying Go to Heroku
Search
Paweł Słomka
February 21, 2019
Programming
0
38
Deploying Go to Heroku
Paweł Słomka
February 21, 2019
Tweet
Share
More Decks by Paweł Słomka
See All by Paweł Słomka
Introduction to WASM using Go 1.11
slomek
0
58
Building Great APIs With gRPC - GoLab 2018
slomek
1
130
Documenting Go Code With Beautiful Tests - GopherCon UK 2018
slomek
0
170
Other Decks in Programming
See All in Programming
Understanding Apache Lucene - More than just full-text search
spinscale
0
110
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
210
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
13
8k
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
2.3k
AI 開発合宿を通して得た学び
niftycorp
PRO
0
100
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1k
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
920
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
180
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
550
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
2
570
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
140
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
940
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.4k
How to make the Groovebox
asonas
2
2k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.1k
How to Ace a Technical Interview
jacobian
281
24k
Why Our Code Smells
bkeepers
PRO
340
58k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
A Tale of Four Properties
chriscoyier
163
24k
Building an army of robots
kneath
306
46k
Being A Developer After 40
akosma
91
590k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
140
Transcript
@pawel_slomka Deploying Go to Heroku Paweł Słomka
@pawel_slomka @pawel_slomka ABOUT ME • Blogger at mycodesmells.com • Go
developer at Ingrid • Co-organizer of GoWroc meetup • Runner ! • Millenial @pawel_slomka
@pawel_slomka WHY • You have some cool code developed locally
• You want to share that code with the world
@pawel_slomka WHERE • There a few options to choose from
(Google App Engine, AWS, Azure, etc.) • Heroku is cool as well • Multiple languages support • Docker support • Free tier (with limitations, but enough for development)
@pawel_slomka HOW I have the following code: package main import
“fmt” import “net/http” func main() { http.HandleFunc(“/“, func(rw http.ResponseWriter, _ *http.Request) { fmt.Fprint(rw, “Hello GoWroc!”) } http.ListenAndServe(“:8080”, nil) }
@pawel_slomka HOW Minor tweak for Heroku support: package main …
import “os” func main() { … http.ListenAndServe(“:”+os.Getenv(“PORT”), nil) }
@pawel_slomka HOW Add config file (heroku.yml) build: docker: web: Dockerfile
@pawel_slomka HOW Add Dockerfile FROM golang:stretch as build COPY .
/src WORKDIR /src RUN go build -o /app . ### FROM heroku/heroku:18 COPY --from=build /app /app CMD ["/app"]
@pawel_slomka DEPLOY Creating an app at Heroku heroku create my-app
heroku container:push -a my-app web Publishing image in Heroku registry: heroku container:release -a my-app web Publishing image in Heroku registry:
@pawel_slomka IT WORKS $ curl https://my-app.herokuapp.com Hello GoWroc!
@pawel_slomka SUMMARY • Little effort • Little time • Huge
satisfaction • Your code is in the cloud!
@pawel_slomka THANK YOU!