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
37
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
56
Building Great APIs With gRPC - GoLab 2018
slomek
1
120
Documenting Go Code With Beautiful Tests - GopherCon UK 2018
slomek
0
170
Other Decks in Programming
See All in Programming
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
48
31k
Benchmark
sysong
0
270
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
lovee
1
260
ASP.NETアプリケーションのモダナイズ インフラ編
tomokusaba
1
420
エラーって何種類あるの?
kajitack
5
320
AWS CDKの推しポイント 〜CloudFormationと比較してみた〜
akihisaikeda
3
320
XP, Testing and ninja testing
m_seki
3
210
Cursor AI Agentと伴走する アプリケーションの高速リプレイス
daisuketakeda
1
130
Result型で“失敗”を型にするPHPコードの書き方
kajitack
4
520
DroidKnights 2025 - 다양한 스크롤 뷰에서의 영상 재생
gaeun5744
3
330
AIプログラマーDevinは PHPerの夢を見るか?
shinyasaita
1
170
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
240
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Code Reviewing Like a Champion
maltzj
524
40k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
A better future with KSS
kneath
239
17k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Optimising Largest Contentful Paint
csswizardry
37
3.3k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
Documentation Writing (for coders)
carmenintech
72
4.9k
Unsuck your backbone
ammeep
671
58k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
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!