Skip to content

Commit b1e7310

Browse files
committed
feat: init dockerfile
1 parent 74b3576 commit b1e7310

File tree

4 files changed

+66
-2
lines changed

4 files changed

+66
-2
lines changed

.github/workflows/publish_docker.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- '*' # Push events to matching tags
7+
8+
env:
9+
REGISTRY: docker.io
10+
IMAGE_NAME: lessapi/base-env-ubuntu-playwright-go
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Read Tag
22+
id: read_tag
23+
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
24+
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ secrets.LESSAPI_DOCKER_HUB_USERNAME }}
33+
password: ${{ secrets.LESSAPI_DOCKER_HUB_ACCESS_TOKEN }}
34+
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
41+
- name: Build and push Docker image
42+
uses: docker/build-push-action@v5
43+
with:
44+
context: .
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}
48+
49+
- name: Logout from DockerHub
50+
run: docker logout

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.idea

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM golang:1.21 as builder
2+
RUN PLAYWRIGHT_GO_VERSION="0.4201.1" \
3+
&& go install github.com/playwright-community/playwright-go/cmd/playwright@${PLAYWRIGHT_GO_VERSION}
4+
5+
FROM ubuntu:jammy
6+
COPY --from=builder /go/bin/playwright /
7+
RUN apt-get update && apt-get install -y ca-certificates tzdata \
8+
&& /playwright install --with-deps chromium \
9+
&& rm -rf /var/lib/apt/lists/*

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
# ubuntu-playwright-go-env
2-
ubuntu docker image with playwright-go & dependencies
1+
# base-env-ubuntu-playwright-go
2+
3+
## Description
4+
5+
This is a base environment for running playwright-go.
6+
It is based on the official Ubuntu image and includes Chromium.

0 commit comments

Comments
 (0)