Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 7 additions & 21 deletions go-gorilla/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,25 @@
# Step 1: Build the Go binary
FROM alpine:edge as BUILDER
FROM golang:1.23.1-bullseye AS builder

# Set the working directory inside the container
WORKDIR /app

# Install Go
RUN apk add --no-cache go

# Copy the Go Modules manifests
COPY go.mod go.sum ./
RUN go mod download

# Download Go modules
RUN go mod download && go mod verify

# Copy the source code into the container
COPY . .

# Build the Go application
RUN go build -v -o /minitwit/app go-gorilla/src

# Step 2: Run the Go binary
FROM alpine:edge
FROM debian:bullseye-slim

# Set the working directory inside the container
WORKDIR /minitwit

RUN apk add --no-cache ca-certificates
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Copy the Go binary and required files from the builder stage
COPY --from=BUILDER /minitwit/app /minitwit/app
COPY --from=builder /minitwit/app /minitwit/app
COPY ./templates/ /minitwit/templates/
COPY ./static/ /minitwit/static/

# Expose the port the web server will run on
EXPOSE 5000
EXPOSE 5001

# Run the Go binary
CMD ["/minitwit/app"]
39 changes: 39 additions & 0 deletions go-gorilla/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Step 1: Build the Go binary
FROM alpine:edge as BUILDER

# Set the working directory inside the container
WORKDIR /app

# Install Go
RUN apk add --no-cache go

# Copy the Go Modules manifests
COPY go.mod go.sum ./

# Download Go modules
RUN go mod download && go mod verify

# Copy the source code into the container
COPY . .

# Build the Go application
RUN go build -v -o /minitwit/app go-gorilla/src

# Step 2: Run the Go binary
FROM alpine:edge

# Set the working directory inside the container
WORKDIR /minitwit

RUN apk add --no-cache ca-certificates

# Copy the Go binary and required files from the builder stage
COPY --from=BUILDER /minitwit/app /minitwit/app
COPY ./templates/ /minitwit/templates/
COPY ./static/ /minitwit/static/

# Expose the port the web server will run on
EXPOSE 5000

# Run the Go binary
CMD ["/minitwit/app"]
2 changes: 1 addition & 1 deletion go-gorilla/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func main() {
*----------------------*/
r := mux.NewRouter()
routes.SetRouteHandlers(r)
err = http.ListenAndServe(":5000", r)
err = http.ListenAndServe(":5001", r)
if err != nil {
log.Fatalf("Failed to start server: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion go-gorilla/templates/timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<h1>MiniTwit</h1>
<div class="navigation">
{{if .UserID}}
<a href="{{url_for "timeline" "" }}">my timeline</a> |
<a href="{{url_for "my_timeline" "" }}">my timeline</a> |
<a href="{{url_for "public_timeline" "" }}">public timeline</a> |
<a href="{{url_for "logout" "" }}">sign out [{{.User}}]</a>
{{else}}
Expand Down
12 changes: 6 additions & 6 deletions javascript-express/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
FROM alpine:edge
FROM debian:bullseye-slim

RUN apk add --no-cache curl bash gcc libstdc++ libgcc && curl -fsSL https://bun.sh/install | bash

ENV PATH="/root/.bun/bin:${PATH}"
RUN apt-get update && apt-get install -y curl
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
RUN apt-get install -y nodejs

WORKDIR /waect-javascript-express

ENV RUN_TYPE=dev

COPY package.json ./

RUN bun install
RUN npm install

COPY ./src .

EXPOSE 5000

CMD ["bun", "app.js"]
CMD ["node", "app.js"]
19 changes: 19 additions & 0 deletions javascript-express/Dockerfile.alpine-bun
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM alpine:edge

RUN apk add --no-cache curl bash gcc libstdc++ libgcc && curl -fsSL https://bun.sh/install | bash

ENV PATH="/root/.bun/bin:${PATH}"

WORKDIR /waect-javascript-express

ENV RUN_TYPE=dev

COPY package.json ./

RUN bun install

COPY ./src .

EXPOSE 5000

CMD ["bun", "app.js"]
9 changes: 6 additions & 3 deletions ruby-sinatra/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
FROM alpine:edge
FROM debian:bullseye-slim

ENV APP_ENV=production
ENV PORT=5000

RUN apk add --no-cache ruby ruby-dev build-base postgresql-dev && gem install bundler
RUN apt-get update && apt-get install -y curl build-essential libpq-dev libssl-dev
RUN curl -L https://github.com/postmodern/ruby-install/archive/master.tar.gz | tar xz
RUN cd ruby-install-master && make install
RUN ruby-install --system ruby 3.3.0

WORKDIR /waect-ruby-sinatra

COPY Gemfile ./

RUN bundle install
RUN gem install bundler && bundle install

COPY ./src .

Expand Down
18 changes: 18 additions & 0 deletions ruby-sinatra/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM alpine:edge

ENV APP_ENV=production
ENV PORT=5000

RUN apk add --no-cache ruby ruby-dev build-base postgresql-dev && gem install bundler

WORKDIR /waect-ruby-sinatra

COPY Gemfile ./

RUN bundle install

COPY ./src .

EXPOSE 5000

CMD ["bundle", "exec", "ruby", "main.rb"]
13 changes: 8 additions & 5 deletions rust-actix/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
FROM alpine:edge AS builder
FROM debian:bullseye-slim AS builder
WORKDIR /usr/src/waect-rust
RUN apk update && apk add --no-cache rust cargo libpq-dev
RUN apt-get update && apt-get install -y curl build-essential libpq-dev libssl-dev pkg-config

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:$PATH"

COPY . .
RUN cargo build --release
RUN cargo build --release

FROM alpine:edge
FROM debian:bullseye-slim
WORKDIR /usr/src/waect-rust
COPY --from=builder /usr/src/waect-rust/target/release/waect-rust ./
COPY src/frontend/static/ ./src/frontend/static/
RUN apk update && apk add libc6-compat libgcc libpq
RUN apt-get update && apt-get install -y libpq5 && rm -rf /var/lib/apt/lists/*

EXPOSE 5000

Expand Down
16 changes: 16 additions & 0 deletions rust-actix/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM alpine:edge AS builder
WORKDIR /usr/src/waect-rust
RUN apk update && apk add --no-cache rust cargo libpq-dev

COPY . .
RUN cargo build --release

FROM alpine:edge
WORKDIR /usr/src/waect-rust
COPY --from=builder /usr/src/waect-rust/target/release/waect-rust ./
COPY src/frontend/static/ ./src/frontend/static/
RUN apk update && apk add libc6-compat libgcc libpq

EXPOSE 5000

CMD ["./waect-rust"]
Loading