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
高度なUI/UXこそHotwireで作ろう Kaigi on Rails 2025
naofumi
4
3.9k
非同期jobをtransaction内で 呼ぶなよ!絶対に呼ぶなよ!
alstrocrack
0
720
Server Side Kotlin Meetup vol.16: 内部動作を理解して ハイパフォーマンスなサーバサイド Kotlin アプリケーションを書こう
ternbusty
3
180
Android16 Migration Stories ~Building a Pattern for Android OS upgrades~
reoandroider
0
100
「ちょっと古いから」って避けてた技術書、今だからこそ読もう
mottyzzz
10
6.6k
CSC305 Lecture 06
javiergs
PRO
0
220
オープンソースソフトウェアへの解像度🔬
utam0k
13
2.6k
AI Coding Meetup #3 - 導入セッション / ai-coding-meetup-3
izumin5210
0
3.3k
All About Angular's New Signal Forms
manfredsteyer
PRO
0
120
(Extension DC 2025) Actor境界を越える技術
teamhimeh
1
250
私はどうやって技術力を上げたのか
yusukebe
43
18k
uniqueパッケージの内部実装を支えるweak pointerの話
magavel
0
980
Featured
See All Featured
A designer walks into a library…
pauljervisheath
209
24k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
238
140k
Keith and Marios Guide to Fast Websites
keithpitt
411
23k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
Bash Introduction
62gerente
615
210k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
GraphQLとの向き合い方2022年版
quramy
49
14k
Code Review Best Practice
trishagee
72
19k
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!